Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Accessibility improvements #549

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"dependencies": {
"babel-plugin-emotion": "^10.0.33",
"customize-cra": "^1.0.0",
"react-focus-lock": "^2.2.1",
"timeago.js": "^4.0.2"
},
"peerDependencies": {
Expand Down
38 changes: 17 additions & 21 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React, { useState, useEffect } from 'react';
import { css } from '@emotion/react';

import FocusLock from 'react-focus-lock';

import {
neutral,
border,
Expand Down Expand Up @@ -208,25 +206,23 @@ export const Dropdown = ({ id, label, options, pillar, onSelect }: Props) => {
{activeLink ? activeLink.title : 'Please select'}
</button>
</div>
<FocusLock>
<ul id={dropdownID} css={[ulStyles, isExpanded && ulExpanded]}>
{options.map((option, index) => (
<li key={option.title}>
<button
onClick={() => onSelect(option.value)}
css={[
linkStyles(!!option.disabled),
option.isActive && activeStyles(pillar),
index === 0 && firstStyles,
]}
disabled={option.isActive || option.disabled}
>
{option.title}
</button>
</li>
))}
</ul>
</FocusLock>
<ul id={dropdownID} css={[ulStyles, isExpanded && ulExpanded]}>
{options.map((option, index) => (
<li key={option.title}>
<button
onClick={() => onSelect(option.value)}
css={[
linkStyles(!!option.disabled),
option.isActive && activeStyles(pillar),
index === 0 && firstStyles,
]}
disabled={option.isActive || option.disabled}
>
{option.title}
</button>
</li>
))}
</ul>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const RecommendationCount = ({
onClick={() => tryToRecommend()}
disabled={recommended || !isSignedIn || userMadeComment}
data-link-name="Recommend comment"
aria-label="Recommend comment"
>
<div css={arrowStyles(recommended)}>
<SvgArrowUpStraight />
Expand Down
39 changes: 1 addition & 38 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9673,11 +9673,6 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

focus-lock@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.7.0.tgz#b2bfb0ca7beacc8710a1ff74275fe0dc60a1d88a"
integrity sha512-LI7v2mH02R55SekHYdv9pRHR9RajVNyIJ2N5IEkWbg7FT5ZmJ9Hw4mWxHeEUcd+dJo0QmzztHvDvWcc7prVFsw==

[email protected]:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
Expand Down Expand Up @@ -16708,13 +16703,6 @@ react-app-polyfill@^1.0.5:
regenerator-runtime "^0.13.3"
whatwg-fetch "^3.0.0"

react-clientside-effect@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/react-clientside-effect/-/react-clientside-effect-1.2.2.tgz#6212fb0e07b204e714581dd51992603d1accc837"
integrity sha512-nRmoyxeok5PBO6ytPvSjKp9xwXg9xagoTK1mMjwnQxqM9Hd7MNPl+LS1bOSOe+CV2+4fnEquc7H/S8QD3q697A==
dependencies:
"@babel/runtime" "^7.0.0"

react-color@^2.17.0:
version "2.19.3"
resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.19.3.tgz#ec6c6b4568312a3c6a18420ab0472e146aa5683d"
Expand Down Expand Up @@ -16858,18 +16846,6 @@ react-fast-compare@^3.0.1, react-fast-compare@^3.2.0:
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==

react-focus-lock@^2.2.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/react-focus-lock/-/react-focus-lock-2.4.1.tgz#e842cc93da736b5c5d331799012544295cbcee4f"
integrity sha512-c5ZP56KSpj9EAxzScTqQO7bQQNPltf/W1ZEBDqNDOV1XOIwvAyHX0O7db9ekiAtxyKgnqZjQlLppVg94fUeL9w==
dependencies:
"@babel/runtime" "^7.0.0"
focus-lock "^0.7.0"
prop-types "^15.6.2"
react-clientside-effect "^1.2.2"
use-callback-ref "^1.2.1"
use-sidecar "^1.0.1"

react-helmet-async@^1.0.2:
version "1.0.7"
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.0.7.tgz#b988fbc3abdc4b704982bb74b9cb4a08fcf062c1"
Expand Down Expand Up @@ -19293,7 +19269,7 @@ ts-pnp@^1.1.6:
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==

tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
tslib@^1.8.1, tslib@^1.9.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
Expand Down Expand Up @@ -19683,11 +19659,6 @@ url@^0.11.0:
punycode "1.3.2"
querystring "0.2.0"

use-callback-ref@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.2.1.tgz#898759ccb9e14be6c7a860abafa3ffbd826c89bb"
integrity sha512-C3nvxh0ZpaOxs9RCnWwAJ+7bJPwQI8LHF71LzbQ3BvzH5XkdtlkMadqElGevg5bYBDFip4sAnD4m06zAKebg1w==

use-composed-ref@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/use-composed-ref/-/use-composed-ref-1.1.0.tgz#9220e4e94a97b7b02d7d27eaeab0b37034438bbc"
Expand All @@ -19707,14 +19678,6 @@ use-latest@^1.0.0:
dependencies:
use-isomorphic-layout-effect "^1.0.0"

use-sidecar@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/use-sidecar/-/use-sidecar-1.0.2.tgz#e72f582a75842f7de4ef8becd6235a4720ad8af6"
integrity sha512-287RZny6m5KNMTb/Kq9gmjafi7lQL0YHO1lYolU6+tY1h9+Z3uCtkJJ3OSOq3INwYf2hBryCcDh4520AhJibMA==
dependencies:
detect-node "^2.0.4"
tslib "^1.9.3"

use@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"
Expand Down