-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-12627165@ Improve accessibility of quantity picker #1552
Conversation
1. Add aria-labels for the buttons 2. Allow keyboard focus on the buttons 3. Allow space/enter to trigger button click
packages/template-retail-react-app/app/static/translations/compiled/en-US.json
Outdated
Show resolved
Hide resolved
</Button> | ||
<Input {...input} /> | ||
<Button data-testid="quantity-increment" {...inc}> | ||
+ | ||
<FormattedMessage id="product_view.label.quantity_increment" defaultMessage="+" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need translations for these symbols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn on VoiceOver. Tab into [+] and [-] to see that it says "increment quantity" / "decrement quantity", rather than just "plus" / "minus".
The interaction/functionality works fine but it keeps reading the "Missing translation" error out loud instead of the actual label.
@wjhsf Is it just me... I'm seeing the minus sign rendered like this: |
@@ -428,10 +428,9 @@ const ProductView = forwardRef( | |||
<Box fontWeight="bold"> | |||
<label htmlFor="quantity"> | |||
{intl.formatMessage({ | |||
defaultMessage: 'Quantity', | |||
defaultMessage: 'Quantity:', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL: react-intl will know to exclude the colon sign in this case.
await user.type(input, '{shift>}{tab}') // > modifier in {shift>} means "keep key pressed" | ||
const button = screen.getByText('−') | ||
expect(button).toHaveFocus() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, adding tests for accessibility 👍
packages/template-retail-react-app/app/components/quantity-picker/index.jsx
Outdated
Show resolved
Hide resolved
This reverts commit c112bce.
Signed-off-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
(git2GUS compliant redo of #1545)
Description
Types of Changes
Changes
How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization