-
Notifications
You must be signed in to change notification settings - Fork 65
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
654: Announce Number of Filters & 627: Keep Keyboard Focus on Filter Button #687
654: Announce Number of Filters & 627: Keep Keyboard Focus on Filter Button #687
Conversation
… blur when filter view toggled off
@jgrimes86 is attempting to deploy a commit to the Clean and Green Philly Team on Vercel. A member of the Team first needs to authorize it. |
@bacitracin or @marvieqa I think you are the appropriate code approvers to review this PR? |
I think this PR also addresses issue #626, which appears to be a duplicate if issue #654 (or vice versa) Issue 626 suggests using I could try to revise this PR to use a variable for the aria-label instead of using the screen-reader-only elements that I've added. In hindsight, that seems like better practice, but I'll wait for input from the PR review before I re-work things. |
@jgrimes86 Thanks for the heads up. In the future you can feel free to tag me under Reviewers for a11y-related PRs. |
@bacitracin I made a commit to this PR to re-add the aria-label and get rid of the screen-reader only components. Looking through previous PRs, I saw that one of them (number 608) had added the aria-label so that the screen reader would correctly announce the button on small screens, so me deleting it re-introduced an issue that was previously fixed. I figured whatever other changes or corrections are needed, that issue was yet another reason to put the aria-label back so I might as well take care of it now. |
@@ -103,20 +103,15 @@ const SearchBarComponent: FC<SidePanelControlBarProps> = ({ | |||
)} | |||
<ThemeButton | |||
color="tertiary" | |||
aria-label="Filter" | |||
aria-label={filterCount === 0 ? "Filter Button" : `Filter Button ${filterCount} filters active`} | |||
aria-roledescription=' ' |
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.
Keeping the semantic meaning of the button is more important than matching the suggested text order, so you can remove this line 'aria-roledescription=' '
. Also aria-roledescription
should never be an empty string, it should be a semantic role that you apply to divs or other HTML elements that have no existing role.
For the aria-label you usually don't want to include words like "button" or "image." Ideally that will come from the component being coded semantically (a real button element instead of a div for ex). So once you remove that aria-roledescription line, you can also remove "button" from both of the labels.
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.
@jgrimes86 Thanks for adding the aria-label back in. I had a small cleanup comment. You don't need the "button" text or the "aria-roledescription." Other than that, looks good! You can tag me again when it's updated and I'll approve/merge. |
@bacitracin I made those changes. Thank you for the explanations in the code comments. |
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.
👍 Looks good!
This PR addresses issues #654 and #627
For issue 654:
Two screen-reader-only spans have been added to the filter button label so that a screen reader can announce the filter button with the number of filters currently applied. When no filters are applied it announces 'Filter button'. When 2 filters are applied, it announces 'Filter button 2 filters applied'. To allow the screen reader to read the label in that order, the aria-label property was removed and the default 'Button' announcement is overridden by adding
aria-roledescription=' '
For issue 627:
The 'if' statement has been removed from the filtuer button's onPress function so that the focus stays on the filter button when filter view is toggled off.
To test:
Note: If one of the active filters is a panel in the 'Get Access' section and you tab back into the filter view, the panel will not appear selected, although though the filter will still be active. This is a bug being addressed by issue 685