Repository navigation
Made the graph controls and sidebar toggle keyboard and screen reader accessible - #1849
Merged
david-yz-liu merged 2 commits intoDec 2, 2026
Conversation
Coverage Report for CI Build 46320251721Coverage increased (+0.09%) to 62.404%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
david-yz-liu
approved these changes
Dec 2, 2026
david-yz-liu
left a comment
Contributor
There was a problem hiding this comment.
Thanks @danielrafailov. These changes look great, and so I'm going to merge in this PR now, but you can make the two other improvements you suggested in the PR comments in a separate pull request.
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
The first of the graph accessibility PRs discussed earlier (the graph controls). The zoom in, zoom out and reset view buttons and the sidebar toggle can't be used properly with a keyboard or screen reader:
onMouseDown, which only fires for a real mouse press, so pressing Enter on a focused zoom button did nothing. (VoiceOver's VO+Space worked, since it simulates a full mouse click.).graph-control-buttonsetoutline: none, so there was no way to tell which one was focused.aria-hidden, so Chrome's Accessibility pane showedName: ""and screen readers just said "button".<div>with anonClick, and its image had noalt, so it also had no meaningful name.Changes:
Button.tsx: added anonClickprop (fires for mouse clicks, Enter and Space) and anariaLabelprop that setsaria-label. The existingmouseDownprop is unchanged.Graph.js:onClickinstead ofmouseDown.alt="Reset View".Sidebar.tsx:<button type="button">, so it's reachable with Tab and works with Enter and Space.aria-expanded, so screen readers announce e.g. "Course sidebar, collapsed, button". It also hasaria-controls, pointing to the panel's newid="sidebar-dropdown".alt="", since it's decorative and the button is already labelled.app.scss:outline: nonefrom.graph-control-buttonand added a:focus-visibleoutline, using the existing--primary-color.:focus-visibleshows the outline for keyboard focus but not after a mouse click, so nothing changes for mouse users. The same outline is added to.sidebar-button.border: 0andalign-items: centerto.sidebar-button, so the new<button>looks the same as the old<div>: no default 3D border, and the arrow in the same position.Button.test.js:ariaLabelsets the accessible name, andonClickis called on a mouse click, Enter and Space.Graph.test.js: the zoom and reset view buttons have accessible names, Enter on each zoom button zooms, and Enter on reset view resets the view.Sidebar.test.js: the toggle has the right name,aria-expandedandaria-controls, and Enter opens the sidebar. The Sidebar snapshot is updated for the<div>→<button>change.I tested this in Chrome (mouse, Tab and Enter/Space, and the Accessibility pane) and in Safari with VoiceOver. For mouse users the only difference is that the zoom and reset buttons now act when the mouse button is released rather than pressed.
Screenshots of your changes (if applicable)
Zoom in button focused with Tab, before the change (no visible focus):





Zoom in button focused with Tab, after the change:
Sidebar toggle focused with Tab, after the change (not reachable with Tab before):
Chrome Accessibility pane for the zoom in button, before the change (
Name: ""):Chrome Accessibility pane for the zoom in button, after the change (
Name: "Zoom in"):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
Buttoncomponent withmouseDown, so Enter doesn't work on them either. Switching them toonClickalso needsstopPropagation, since a click would otherwise reach the course row's ownonClick. I left them out to keep this PR to the controls we discussed, but I can fix them here or in a follow-up.outline: none, so its keyboard focus is invisible too. It's the same two-line fix as the graph buttons. Happy to add it here if you'd like.