Fix keyboard access for sidebar toggle#3078
Open
lawrence3699 wants to merge 1 commit intorust-lang:masterfrom
Open
Fix keyboard access for sidebar toggle#3078lawrence3699 wants to merge 1 commit intorust-lang:masterfrom
lawrence3699 wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
I'm going to test it this week. Thank you for making this documentation generator more accessible! |
|
If the fix doesn't touch the no-js version, should the toggle be un-hidden there so accessibility doesn't degrade without JS? |
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.
Fixes #2615.
The sidebar toggle was rendered as a label for the hidden checkbox. Unlike the neighboring theme and search controls, it could not receive focus as a button, and pressing Enter did not toggle the sidebar.
This keeps the checkbox/label path for no-JavaScript output, but renders the JavaScript-enabled control as a native button. The button toggles the same checkbox and dispatches its existing change handler, so the current sidebar state, ARIA updates, and localStorage behavior stay on the existing path.
The GUI regression focuses the toggle directly because Tab traversal was not reliable in the headless test harness; it verifies the control can receive focus and that Enter toggles the sidebar closed and open.
Validation:
cargo test --test gui -- sidebar.gomlcargo test --test gui -- sidebar-nojs.gomlnpm run lintgit diff --check