Repository navigation
fix(Dialog): focus on open, top dialog only on click outside, role on the panel (3.0) - #357
Merged
Merged
Conversation
… the panel (3.0) From the Graphite migration report (Once UI 2.6 adopted by a real app): - A Dialog that mounts open never took focus: its overlay was visibility: hidden until the open class landed a tick later, and focus() on a hidden element does nothing. The overlay is transparent and non-interactive for that frame instead. - Every open Dialog answered clicks outside, so a click in a stacked dialog closed the one beneath it. Only the innermost overlay answers now, as with Escape (useOverlay exposes isInnermost). - The Toaster is exempt from the overlay's inert and from click outside (data-overlay-exempt), so a toast's Undo works under a dialog. - role="dialog", aria-modal, the accessible name, className and ref now sit on one element, the panel (as on Drawer). aria-label overrides the title as its name. - A string title renders an h2, not a second h1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gNJtvihFgt8bSFzr13Wsn
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
16 tasks
Member
Author
|
The "Compare" visual check failed on one shot: Generated by Claude Code |
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.
Requested by Lorant · project thread
These fix the Dialog findings from the Graphite migration report, where a real Vite + React app adopted Once UI 2.6 and its e2e suite caught them. 3.0 had already fixed two of them: Escape only closes the innermost overlay, and inert is restored to its previous state. This PR covers what was still open on the 3.0 branch.
Changes
.openclass landed a tick later, the overlay wasvisibility: hidden.focus()does nothing on a hidden element, so focus fell to<body>while the page behind was already inert. For that first frame the overlay is nowopacity: 0; pointer-events: none.useOverlaynow exposesisInnermost(), the same rule Escape already follows.data-overlay-exempt. The overlay core does not make it inert, and Dialog does not treat clicks on it as outside, so a toast's Undo or Try again can be clicked.role="dialog",aria-modal, the accessible name,classNameandrefall sit on the panel now, as they already do on Drawer. Before, role and name were on the full-screen overlay and className was on the panel. Anaria-labelnow overrides the title as the name, which matters when the title is a node such as a tab bar.titlerenders anh2, not a secondh1.role="dialog"element's parent.Not in this PR (filed separately): the fixed z-index 8/9, the full-screen layout below 1024 px with no size prop, and slot props for body, footer and overlay.
Checks
vitest run: 3895/3895 pass. There are new tests for stacked click outside, the exempt Toaster region, role and className on the panel, thearia-labeloverride and the h2 title.tsc --noEmitis clean. Biome reports no new findings in the touched files.Generated by Claude Code