Repository navigation
fix: update collapse button aria-label and aria-expanded on toggle - #62
Merged
Merged
Conversation
The toolbar collapse button's aria-label and aria-expanded attributes never changed when the toolbar was collapsed or expanded, including when a collapsed state was restored from localStorage on page load. The button always announced "Collapse toolbar" with aria-expanded "true" regardless of actual state. Add updateCollapseButton() to sync the label, title, and aria-expanded attribute with the current collapsed state, called on init and on every toggle.
Contributor
|
JacobCoffee
enabled auto-merge (squash)
October 11, 2026 00:35
Merged
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.
The toolbar collapse button's screen-reader label never changed when the toolbar was collapsed or expanded, and the stale label persisted even after a collapsed state was restored from localStorage on page load.
What was wrong: the button always announced "Collapse toolbar" with
aria-expanded="true", regardless of the toolbar's actual collapsed state.What changed: added
updateCollapseButton()insrc/debug_toolbar/core/assets.pythat syncs the button'stitle,aria-label("Collapse toolbar" / "Expand toolbar"), andaria-expandedwith the current state. It's called once on init (to handle a collapsed state restored from storage) and again on everytoggle().How verified:
tests/integration/test_litestar_middleware.py(TestCollapseButtonAccessibility) checking the initial markup and that the served JS contains the fix; confirmed it fails on the pre-fix JS and passes after.make cipasses in the worktree.examples/litestar_basic: initial state, after collapsing, after expanding, and after reloading while collapsed all show the correctaria-label/aria-expanded.