fix(ui): expose Drawer as an accessible modal dialog#6643
Merged
Conversation
The base Drawer panel rendered as a plain <div>, so assistive tech saw no dialog role, no modal boundary, and no accessible name — affecting all 15+ drawers (MFA, connect, firewall rules, SSH keys, namespace edits, ...). Add role="dialog", aria-modal="true", and aria-labelledby pointing at the title heading via a useId()-generated id (a stable literal id would collide since closed drawers stay mounted behind inert). The focus trap and Escape handling were already wired via useFocusTrap/useEscapeKey. Fixes: shellhub-io/team#128
|
Claude finished @otavio's task in 46s —— View job Code Review CompleteReviewed 2 files across code quality, security, testing, language patterns, The To request another review round, comment |
otavio
enabled auto-merge (rebase)
July 13, 2026 19:45
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.
What
The base
Drawercomponent now exposes its panel as an accessible modal dialog —role="dialog",aria-modal="true", and an accessible name viaaria-labelledby. This fixes accessibility for all 15+ drawers at once (MFA, connect, firewall rules, SSH keys, namespace edits, …).Why
Drawer.tsxrendered the panel as a plain<div>, so assistive tech saw no dialog role, no modal boundary, and no accessible name tying the panel to its title. Focus trapping and Escape-to-close were already implemented (useFocusTrap/useEscapeKey) — only the ARIA layer was missing.Fixes shellhub-io/team#128
Changes
role="dialog",aria-modal="true", andaria-labelledbyon the panel; added anidon the<h2>title. The id comes from React'suseId()rather than a fixed string — closed drawers stay mounted behindinert, so a literal id would produce duplicate-id collisions and an ambiguousaria-labelledbywhen more than one drawer is in the DOM.role="dialog"with the title as its accessible name, and thataria-labelledbyresolves to the heading's id.Testing
npm run test(console): 2622 pass, incl. the new Drawer test;npm run build(tsc) clean; eslint clean on the changed files. The two remaining eslint warnings are pre-existing, on the backdrop overlay div's click handler — unrelated to this change.