Repository navigation
Made the sidebar's remove buttons and Reset Selections keyboard and screen reader accessible - #1853
Open
danielrafailov wants to merge 2 commits into
Open
danielrafailov wants to merge 2 commits into
danielrafailov wants to merge 2 commits into
Conversation
…after their course, and showed a focus outline on Reset Selections
Coverage Report for CI Build 47010364992Coverage increased (+0.03%) to 63.322%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
A follow-up to #1849, making the two sidebar improvements suggested in its comments. Before this change, the "X" buttons next to each selected course only responded to the mouse button being pressed down, so pressing Enter or Space on them did nothing. VoiceOver also read every one as just "X, button", with nothing to say which course it removes. The Reset Selections button set
outline: none, so keyboard focus on it was invisible, and a keyboard user could clear all their selected courses without seeing they were on it.Changes:
Sidebar.tsx: each X button:onClickinstead ofmouseDown, so it works with Enter and Space as well as the mouse.onClickopens the course's info. Without this, removing a course would also open its info.Button.tsx:onClickis typed asReact.MouseEventHandler<HTMLButtonElement>instead of() => void, so the X button's handler can use the event to stop it. The graph controls' existing handlers are unaffected.app.scss: removedoutline: nonefrom Reset Selections and gave it the same:focus-visibleoutline as the graph controls and sidebar toggle from Made the graph controls and sidebar toggle keyboard and screen reader accessible #1849. The outline only shows for keyboard focus, so nothing changes for mouse users. The X buttons already had this outline from Made the graph controls and sidebar toggle keyboard and screen reader accessible #1849, since they use theButtoncomponent.Sidebar.test.js:mouseDownbehaviour. They now use a full click.I tested the X buttons with VoiceOver and the keyboard, and the Reset Selections outline by tabbing to it with VoiceOver off.
Screenshots of your changes (if applicable)
Reset Selections with keyboard focus, before the change (no outline):




Reset Selections with keyboard focus, after the change:
VoiceOver on a selected course's X button, before the change:
VoiceOver on a selected course's X button, after the change:
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
<div>/<li>elements, so keyboard users can't reach them and VoiceOver doesn't announce them as clickable. I kept this PR to the two changes from Made the graph controls and sidebar toggle keyboard and screen reader accessible #1849, but I can fix these in a follow-up.Button'smouseDownprop is no longer used anywhere, since the X buttons were the only thing using it. I left it in to keep the change small, but I can remove it here if you'd like.