fix(a11y): unique modal title ids and close-time listener cleanup - #24
Conversation
Give each instance its own modal-title id, attach Escape and focus-trap listeners only while open, and skip smooth in-modal scrolling when prefers-reduced-motion is set. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Comment |
Summary
Closes #19, #21, and #22 (D8, D10, D11 from the ChatCPT WCAG 2.2 AA audit).
Stacked or retained modal overlays no longer share
id="modal-title", leave document keydown handlers attached after close, or ignoreprefers-reduced-motionon in-content hash links.Changes
Title ids follow the dropdown pattern:
modal-title-${n}per instance, witharia-labelledbypointing at that id (omitted until a title exists).Escape and focus-trap listeners attach in
open()and detach inclose(). Escape closes only the top ofopenModalStack, so a confirm dialog on top of settings does not dismiss both.In-modal hash links use
scrollIntoView({ behavior: 'auto' })whenprefers-reduced-motion: reduce. Default motion is unchanged.Overlays still stay in the DOM after close, which is the existing reopen API. Unique ids make that safe. D9 (translated accessible names) is a separate contract change and is not in this PR.
Test plan
aria-labelledbymatchesclose()clears document listeners;open()reattachesautounder reduced motionnpm test)components/modal/test.htmlChatCPT does not hardcode
modal-title. After merge, the app needs a submodule bump; no constructor API change here.