[dialog] Fix nested-dialog counts and dismissal edge cases#5033
Draft
atomiks wants to merge 1 commit into
Draft
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,150.96 ms ▼-303.28 ms(-20.9%) | Renders: 50 (+0) | Paint: 1,745.44 ms ▼-438.95 ms(-20.1%)
…and 1 more (+6 within noise) — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Aggregate nested dialog/drawer counts per child (keyed by a stable id, via Math.max) so closing one sibling no longer zeroes the parent while another stays open, which also fixes Escape/outside-press topmost gating (B4). - Accept touchend outside-press by counting changedTouches instead of the now-empty touches list (B6). - Seed store state directly on first render instead of store.update() so detached trigger subscribers aren't notified mid-render (B7). - Seed a reused handle store's openProp on first render so an initially-open dialog doesn't play an enter transition (B8). - Report the trigger on close using the triggerIdProp-aware selector (B9). - Add a nested sibling-close regression test.
6558238 to
6cbdb10
Compare
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.
Several Dialog/AlertDialog fixes:
Math.max) instead of last-writer-wins, so closing one of two sibling nested dialogs no longer zeroes the parent's count while the other stays open. That fixes the downstream Escape / outside-press "topmost" gating (Escape was closing the parent under a still-open child).changedTouches(thetoucheslist is empty ontouchend, which made the guard a dead path).store.statedirectly instead of viastore.update()(which notifies synchronously during render), matchinguseInitialOpenSync.openPropis seeded on first render so an initially-open<Dialog.Root handle open>doesn't play an enter transition.triggerId-prop-aware selector in fully controlled mode.Adds a nested sibling-close regression test.