Skip to content

Made the sidebar's remove buttons and Reset Selections keyboard and screen reader accessible - #1853

Open
danielrafailov wants to merge 2 commits into
Courseography:masterfrom
danielrafailov:sidebar-buttons-accessibility
Open

danielrafailov wants to merge 2 commits into
Courseography:masterfrom
danielrafailov:sidebar-buttons-accessibility

Conversation

@danielrafailov

@danielrafailov danielrafailov commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

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:
    • Uses onClick instead of mouseDown, so it works with Enter and Space as well as the mouse.
    • Is named after its course (e.g. "Remove CSC108H1"), so VoiceOver reads "Remove CSC108H1, button".
    • Stops the click from reaching the course row, whose own onClick opens the course's info. Without this, removing a course would also open its info.
  • Button.tsx: onClick is typed as React.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: removed outline: none from Reset Selections and gave it the same :focus-visible outline 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 the Button component.
  • Sidebar.test.js:
    • The existing X button tests pressed the mouse button down without releasing it, which only matched the old mouseDown behaviour. They now use a full click.
    • New tests: each X button is named after its course, and clicking it or pressing Enter or Space on it removes the course without also clicking the course row.

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):
Screenshot 2026-12-02 at 6 22 29 PM
Reset Selections with keyboard focus, after the change:
Screenshot 2026-12-02 at 6 12 18 PM
VoiceOver on a selected course's X button, before the change:
Screenshot 2026-12-02 at 6 23 54 PM
VoiceOver on a selected course's X button, after the change:
Screenshot 2026-12-02 at 6 13 32 PM

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality) X
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

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:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.
  • I have updated the project Changelog (this is required for all changes).

After opening your pull request:

  • I have verified that the CI checks have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

  • Two other parts of the sidebar still only work with a mouse: clicking a course name under "Selected courses" opens its info, and clicking a search result selects that course. Both are plain <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's mouseDown prop 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.

…after their course, and showed a focus outline on Reset Selections
@coveralls

coveralls commented Dec 2, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 47010364992

Coverage increased (+0.03%) to 63.322%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4348
Covered Lines: 2797
Line Coverage: 64.33%
Relevant Branches: 1023
Covered Branches: 604
Branch Coverage: 59.04%
Branches in Coverage %: Yes
Coverage Strength: 157.15 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants