Skip to content

[dialog][alert dialog][drawer] Make the Root part own the store - #5109

Merged
michaldudak merged 31 commits into
mui:masterfrom
michaldudak:dialog-reset-on-unmount-handcrafted
Jun 30, 2026
Merged

michaldudak merged 31 commits into
mui:masterfrom
michaldudak:dialog-reset-on-unmount-handcrafted

Conversation

@michaldudak

@michaldudak michaldudak commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #4951.

Summary

A module-scoped Dialog.createHandle() used to preserve stale open state after its <Dialog.Root> was unmounted while open, so the next root mounted with the same handle reopened immediately.

This changes the ownership model: each <Dialog.Root> now creates and owns its own store (via useRefWithInit) instead of reusing the handle's store. The handle holds a pointer to the currently mounted root's store and attaches/detaches as roots mount and unmount, so every mount starts from fresh state. Detached triggers follow the handle's store pointer and re-register into the attached root's store when it changes. Imperative handle methods (open, openWithPayload, close) are no-ops while no root is attached (with a dev-only warning), and isOpen returns false.

Note

Using a single handle with two roots mounted at the same time is not supported: the most recently mounted root takes over (a dev-only warning is logged). Handles are expected to be stable and used by a single mounted root for their lifetime.

Changes

  • Make the dialog store owned by Dialog.Root (created once per root) and have the handle attach to it, so reused handles no longer carry stale state across remounts.
  • Make detached triggers follow the handle's attached store, migrating their registration as roots attach/detach.
  • Make imperative handle methods no-ops (with a dev-only warning) while no root is attached, and warn in dev when a second root attaches to a live handle.
  • Add regression coverage for unmounting/remounting handle-backed roots (Dialog, AlertDialog, Drawer).
  • Add a private experiment for manually testing the unmount/remount scenario.
  • Update Dialog, AlertDialog, and generated handle API docs.

@michaldudak michaldudak added the component: dialog Changes related to the dialog component. label Jun 23, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5109
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5109
    

commit: 932c328

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+1.15KB(+0.25%) 🔺+284B(+0.19%)

Details of bundle changes

Performance

Total duration: 1,354.31 ms -1.02 ms(-0.1%) | Renders: 78 (+0)

Test Duration Renders
Select mount (200 instances) 187.33 ms 🔺+44.15 ms(+30.8%) 3 (+0)

13 tests within noise — details

Metric alarms

Test Metric Change
Select mount (200 instances) bench:paint 🔺 +60.96 ms

Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 932c328
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a43a58e3b6fd0000825cfc7
😎 Deploy Preview https://deploy-preview-5109--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@michaldudak
michaldudak marked this pull request as ready for review June 24, 2026 08:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 100fe447e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e3973faec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@atomiks

atomiks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

PR review

This PR fixes a real bug (#4951): a module-scoped Dialog.createHandle() no longer keeps stale open state after its <Dialog.Root> unmounts while open. The fix is correct and well-targeted for Dialog, and I found no merge-blocking (🔴) issues — the riskiest timing windows (stale floatingRootContext on detached triggers, one-render nested/floatingId gap) all self-heal in practice. The main things worth addressing before merge are a redundant field/constructor-reorder that can be dropped, a few un-pinned test cases (payload reset, AlertDialog, uncontrolled→controlled), and the fact that the same bug class still affects Popover and Menu handles, which this PR's shared infra doesn't actually fix.

Bugs (3)

1. 🟡 Same #4951 bug still affects Popover and Menu handles (fix is Dialog-only)

Location: packages/react/src/popover/store/PopoverStore.ts:202, packages/react/src/menu/store/MenuStore.ts:176

// PopoverStore.useStore — routes through usePopupStore but passes only 3 args:
const { store, internalStore } = usePopupStore(externalStore, (floatingId, nested) => ...);
// MenuStore.useStore — never calls usePopupStore at all:
const internalStore = useRefWithInit(() => new MenuStore(...));
return externalStore ?? internalStore;

PopoverStore.useStore and MenuStore.useStore both accept an external handle store (PopoverRoot.tsx:37, MenuRoot.tsx:107 pass handle?.store), so they have the identical "store outlives Root → stale open state on remount" defect. Popover goes through usePopupStore but doesn't pass the new initializeExternalStore callback, so it's a one-line-ish fix that wasn't applied. Menu doesn't route through usePopupStore at all, so the new mechanism can't reach it without a refactor.

This is pre-existing and out of scope for a [dialog] PR — not a regression. Flagging so it's tracked: the shared usePopupStore hook now carries reset infrastructure that two of its three handle-capable consumers don't use.

Failure scenario: A module-scoped Popover.createHandle() (or Menu.createHandle()) whose Root unmounts while open, then remounts, shows the popup/menu auto-opened with stale state — exactly #4951, but for Popover/Menu.

Fix: Either file follow-up issues for Popover/Menu, or (for Popover) pass initialize through the same 4th arg. No change required to land the Dialog fix.

2. ℹ️ Detached triggers briefly reference the orphaned floatingRootContext after a closed remount

Location: packages/react/src/dialog/store/DialogStore.ts (initialize) + packages/react/src/utils/popups/popupStoreUtils.ts (useOnFirstRender block)

initialize replaces this.state (including a brand-new floatingRootContext) by direct assignment with no notify (intentional, to avoid updating subscribers during render). Still-mounted detached Dialog.Triggers subscribe to floatingRootContext and feed it to useClick. After a remount-while-closed, they hold the old, orphaned FloatingRootStore until the next store notification.

In normal usage this self-heals: the remount re-renders the trigger subtree (so useSyncExternalStore reads the fresh snapshot), and even a stale-bound trigger's setOpen routes back to the same DialogStore.setOpen, which dispatches on the live this.state.floatingRootContext. I could not construct an observable break, and the PR's own remount test passes.

Failure scenario: Only reachable if a detached trigger is memoized so it does not re-render when the Root remounts — then its useClick is momentarily bound to a context whose state.open is still true, so the first click could toggle the wrong way until the next notification. Contrived; noting for awareness given the no-notify assumption.

3. ℹ️ Nested handle dialog rebuilds floatingRootContext without nested/floatingId for one render

Location: packages/react/src/dialog/store/DialogStore.ts (initialize → createPopupFloatingRootContext(this.triggerElements))

initialize omits the floatingId/nested args that the constructor passes. This matches the original handle-store construction (new DialogStore() also omits them), and useSyncedFloatingRootContext re-syncs nested synchronously (store.context.nested = nested) and floatingId via effect immediately after. No observable wrong result was constructible, but it's the one "synchronous read between initialize and the post-commit effect" window worth a maintainer's eye, since nested handle-dialog remount has no test.

Fix: Optional — pass floatingId/nested into initialize to match the constructor exactly and remove the transient gap. (Requires threading them through the initializeExternalStore callback.)

Tests (4)

1. 🟡 Stale payload reset on remount is not pinned

Location: packages/react/src/dialog/root/DialogRoot.detached-triggers.test.tsx (new tests, ~line 402+)

handle.openWithPayload(x) does store.set('payload', x). initialize() rebuilds full state so payload is reset — but no test asserts it. A future change to a partial reset that preserves payload would leak a stale payload into children({ payload }) with zero test failure.

Failure scenario: Open a handle dialog with a payload, unmount, remount → render-prop receives the old payload; nothing catches it.

2. 🟡 AlertDialog handle remount has no coverage

Location: packages/react/src/alert-dialog/ (no *.detached-triggers.test.tsx)

AlertDialogHandle extends DialogHandle and shares DialogStore, so the identical bug applies, and the isAlertDialog branch in useRenderDialogRoot.tsx:52 does an extra store.update({ ...rootState }) on first render that now interacts with initialize(). None of this is exercised on a remount.

Failure scenario: A regression in the AlertDialog-specific first-render store.update path (e.g., role: 'alertdialog' lost after remount) ships unnoticed.

3. 🟡 Reverse direction (uncontrolled→controlled) and same-trigger re-open are untested

Location: packages/react/src/dialog/root/DialogRoot.detached-triggers.test.tsx (new tests)

Test 2 only covers controlled→uncontrolled. The reverse hits the dev controlledValues cache from the opposite side ("changing uncontrolled state of openProp to be controlled"). And test 1 re-opens with a different trigger (Trigger 2) after remount, so reusing the same trigger id — where stale activeTriggerId/active-trigger ownership would bite — is unverified.

Failure scenario: A reset that misses openProp in one direction, or stale activeTriggerId ownership claimed by the original trigger on re-open, passes the suite.

4. ℹ️ Controlledness-cache intent isn't asserted; new tests are Chromium-only

Location: packages/react/src/dialog/root/DialogRoot.detached-triggers.test.tsx:283 (enclosing describe.skipIf(isJSDOM))

Both new tests sit inside describe.skipIf(isJSDOM)('multiple detached triggers'), so they never run in the jsdom suite even though they only use toBeVisible()/queryByText(...).toBe(null) (no layout). The whole point of delete controlledValues (preventing the spurious controlled↔uncontrolled console.error) is verified only implicitly via vitest-fail-on-console, with no explicit console.error spy — so a reviewer can't tell test 2 actually exercises that branch (which is dev-only anyway).

Failure scenario: The #4951 regression guard never runs in the fast jsdom CI lane; and if the cache-reset were removed, test 2 might still pass in a production build.

Simplifications (2)

1. 🟡 Redundant triggerElements field + constructor reorder

Location: packages/react/src/dialog/store/DialogStore.ts (constructor + new private triggerElements)

// new field duplicates what's already in context:
this.triggerElements = triggerElements;        // added
private triggerElements: PopupTriggerMap;       // added
// ...but the same instance is already stored as this.context.triggerElements

The same PopupTriggerMap is passed to super(...) and lives at this.context.triggerElements (typed readonly PopupTriggerMap, accessible in initialize). So this.triggerElements === this.context.triggerElements. The new field and the constructor reorder are unnecessary.

Failure scenario: Two names for one object invites drift, and the field is dead weight on every instance.

Fix: Drop the field and the reorder; have initialize() call createPopupFloatingRootContext(this.context.triggerElements).

2. ℹ️ initialize duplicates the constructor's state-building; the dev-cache delete reaches into a base-class private

Location: packages/react/src/dialog/store/DialogStore.ts (initialize)

initialize re-implements createInitialState(...) + floatingRootContext wiring that the constructor already does — these must be edited in lockstep. And delete (this as { controlledValues?: ... }).controlledValues deletes a ReactStore private by string name; a rename in ReactStore would silently no-op and let the false controlled/uncontrolled warning return.

Fix (optional, weigh against scope): Extract a small buildInitialState(triggerElements) shared by constructor and initialize; and consider a dev-only protected resetControlledCache() on ReactStore so the private field is owned where it's defined.

Docs (2)

1. ℹ️ "not queued for a later mount" understates that pre-mount state is discarded

Location: packages/react/src/dialog/store/DialogHandle.ts (JSDoc), alert-dialog/handle.ts, and the four doc files

initialize() wipes the store on the Root's first render, so a pre-mount handle.open()/openWithPayload() doesn't just fail to queue — its effect is actively reset, and the Root mounts closed. "Not queued for a later mount" reads as "not buffered" and could leave a dev expecting the call to have taken effect.

Fix: Tighten to e.g. "…are ignored; the store is reset when the root first mounts."

2. ℹ️ Drawer handle docs still say "control a Dialog"; Popover/Menu handle docs lack the new caveat

Location: docs/src/app/(docs)/react/components/drawer/types.md:489 and popover/types.md / menu/types.md Handle sections

Drawer's generated Handle description reads "A handle to control a Dialog imperatively" (pre-existing, inherited from the shared DialogHandle JSDoc this PR edits). And Popover/Menu handles — which share the same pre-mount constraint — got no caveat, so the docs are now inconsistent across the handle family. Both are generated-output nits, not quick per-file edits.

Verdict

Approve after nits — no 🔴; the Dialog fix is correct and tested, but the redundant field, the un-pinned payload/AlertDialog/reverse-direction tests, and the unfixed Popover/Menu handle bug are worth resolving or tracking before merge.


🤖 Review generated with Claude Code

@michaldudak

Copy link
Copy Markdown
Member Author

I'm going to fix Menu and Popover in separate PRs, not to keep this one open forever.

@atomiks

atomiks commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

PR review

This is a sound ownership-model refactor: each <Dialog.Root> now owns its DialogStore and the handle attaches a pointer to the currently-mounted root, fixing the stale-open-state bug (#4951). Nothing is merge-blocking — all Dialog/AlertDialog/Drawer suites pass (86 + 44 + 19 jsdom, 33 chromium detached-trigger, 17 DialogTrigger), typecheck and lint are clean, and the load-bearing mechanism (merged-ref re-fire migrating a detached trigger between stores) is correct. The findings are polish: a deliberate-but-sharp imperative-before-attach footgun, a couple of test/doc gaps, and an optional bundle-size simplification.

Bugs (4)

1. 🟡 Imperative calls before a root attaches are silently dropped, with no production diagnostic

Location: packages/react/src/dialog/store/DialogHandle.ts:79

openWithPayload(payload: Payload) {
  if (this.attachedStore === null) {
    if (process.env.NODE_ENV !== 'production') { console.warn(/* … */); }
    return; // payload is discarded
  }

This is the intended fix for #4951 (the old shared store leaked stale open state), and it's documented. But it makes the natural "mount the root and open it in the same handler" pattern a no-op: handle.openWithPayload(data) runs synchronously, while the root's attachStore runs in the next commit's layout effect, so attachedStore is still null. The dialog never opens and the payload vanishes. In production the warning is stripped, so there is zero feedback. This previously worked (the handle owned the store, so pre-mount state survived into the root).

Failure scenario: A user clicks a button whose handler both flips setMounted(true) (rendering <Dialog.Root handle={h}>) and calls h.openWithPayload(data). Nothing opens; in prod there's no warning.

Fix: Confirm this tradeoff is intended (it appears to be). Worth considering defer-on-attach — stash the last {open, payload, triggerId} intent on the handle and apply it when a root next attaches (last-wins, cleared after apply). That makes mount-and-open Just Work and neutralizes most migration risk. If deferral is rejected, at minimum keep a production warning for a dropped payload — a payload silently disappearing in prod is the worst of the no-op/warn/throw options.

2. 🟡 The "more than one mounted root" warning can fire during overlapping route transitions

Location: packages/react/src/dialog/store/DialogHandle.ts:157

attachStore(newStore: DialogStore<Payload>) {
  if (this.attachedStore !== newStore) {
    if (process.env.NODE_ENV !== 'production' && this.attachedStore !== null) {
      console.warn('Base UI: A handle is attached to more than one mounted root …');

When an animated route/view transition keeps the outgoing screen mounted for a frame while the incoming screen mounts, two <Root>s using the same handle are briefly attached in the same commit, so the incoming root's attachStore warns even though the outgoing root unmounts immediately after. The "most-recently-mounted wins" contract itself is the right call; only the warning is over-eager. (Bounded to the share-one-handle-across-two-roots case, which the PR already calls unsupported — but transient overlap during a clean handoff shouldn't warn.)

Failure scenario: A user with a module-scoped handle animates between two pages that each render <Dialog.Root handle={h}>; the dev console logs a spurious "attached to more than one root" warning every navigation.

Fix: Tolerate transient overlap — e.g. only warn if the previous store is still attached after a microtask/frame (i.e. the old root didn't unmount). At minimum add a test so the behavior is intentional (see Tests No. 1).

3. ℹ️ Minor breaking change: Handle constructors no longer accept a store argument

Location: packages/react/src/alert-dialog/handle.ts:9, packages/react/src/drawer/handle.ts:11

AlertDialogHandle/DialogHandle are now empty branded subclasses; new AlertDialog.Handle(store) no longer compiles/behaves. The store arg was @internal and the public path is createHandle(), so impact is small, but *.Handle is an exported class. Worth a changelog/breaking-change note for pre-1.0 users.

4. ℹ️ Cross-family inconsistency with Menu/Popover/Tooltip/PreviewCard

Those families still own the store on the handle (this.store = new MenuStore()), so they retain the #4951 stale-state behavior and a different open() contract (throw-on-missing-trigger vs Dialog's warn-and-open). Out of scope here, but worth filing a follow-up so the four families converge on one handle contract before 1.0 — otherwise this PR creates a lasting split in how handles behave.

Tests (3)

1. 🟡 The multi-root "takes over" warning and its detach-cleanup guard are untested

Location: packages/react/src/dialog/store/DialogHandle.ts:157-174 (behavior); no covering test

No test mounts two <Root>s sharing one handle simultaneously. That leaves both the warning (Bugs No. 2) and — more importantly — the if (this.attachedStore === newStore) cleanup guard at line 170 uncovered. That guard is exactly what prevents an unmounting older root from nulling a newer root's attachment; a regression there would silently break the handoff and nothing would catch it.

Failure scenario: A refactor drops the === newStore guard; the older root's unmount detaches the live newer root, the handle goes inert, and the suite stays green.

2. 🟡 AlertDialog invariant assertions are weak after the direct-state test was deleted

Location: packages/react/src/alert-dialog/root/AlertDialogRoot.test.tsx:884

The deleted test asserted store.select('modal'), disablePointerDismissal, and role directly. Its replacement relies on await waitFor(() => expect(screen.queryByRole('alertdialog')).not.toBe(null)) after a backdrop click — but that condition is already true on the first synchronous tick, so waitFor returns immediately and never actually waits for a close to be processed. And modal: true is no longer asserted anywhere for a handle-backed alert dialog (now that AlertDialogHandle's constructor no longer sets it, the invariant flows only through rootState).

Failure scenario: A regression that fails to default modal: true/disablePointerDismissal for handle-backed alert dialogs passes green — the backdrop-click test sees the dialog present on the first tick regardless of whether it's mid-close.

Fix: Assert the dialog is still present after flushing the close attempt (e.g. act/microtask settle), and assert modal/disablePointerDismissal for the handle-backed path.

3. ℹ️ No Strict Mode coverage of attach → detach → re-attach

The new useIsoLayoutEffect(() => handle.attachStore(store), [handle, store]) runs mount→cleanup→mount under Strict Mode. Reasoned safe (cleanup nulls attachedStore between, so no spurious warning), but unexercised.

Simplifications (4)

1. 🟡 NullDialogStore re-implements read-path methods the base store already provides

Location: packages/react/src/dialog/store/DialogStore.ts:129-182

select/useState/subscribe/getSnapshot are byte-for-byte equivalent to ReactStore/Store (e.g. useState copies useDebugValue(key) + useStore(this, selectors[key], …)). The only thing the null store genuinely needs that a real store doesn't is no-op update/set. A class NullDialogStore extends DialogStore whose constructor freezes this.state and overrides update/set/setState to no-ops removes ~40 lines plus the NOOP/useStore/useDebugValue imports and the two as DialogStore[...] casts, while keeping identical inert semantics.

Tradeoff to weigh (why the author may have chosen the current form): the standalone implements DialogHandleStore structurally prevents callers from ever invoking setOpen on the inert store — subclassing DialogStore re-widens the type and exposes setOpen (which would partially execute, including floatingRootContext.dispatchOpenChange). Given the repo's bundle-size focus this is worth doing, but only if the narrowed-type safety is preserved another way (e.g. keep returning DialogHandleStore from the getter). Your call.

2. ℹ️ DialogHandleStore and PopupTriggerDataStore are the same Pick declared twice

Location: packages/react/src/dialog/store/DialogStore.ts:57-60 and packages/react/src/utils/popups/popupStoreUtils.ts:55-58

Both pick 'context' | 'select' | 'set' | 'state' | 'update' | 'useState'. DialogHandleStore<Payload> is just PopupTriggerDataStore<State<Payload>>; define the member set once and reuse it so the two can't drift.

3. ℹ️ isOpen indirection

Location: packages/react/src/dialog/store/DialogHandle.ts:122

get isOpen() { return this.store.select('open'); } routes through the fallback store with a 2-line comment justifying the equivalence. return this.attachedStore?.select('open') ?? false; is one line, needs no comment, and doesn't depend on the null store always reporting closed.

4. ℹ️ useDialogRootStore duplicates the floating-context wiring of usePopupStore

Location: packages/react/src/dialog/root/useRenderDialogRoot.tsx:85-117

The useId + useFloatingParentNodeId + useRefWithInit(new DialogStore) + useSyncedFloatingRootContext({...}) block is nearly identical to usePopupStore. The divergence is defensible (dialog never takes an external store and adds the attachStore effect), but a "create-only, no external store" mode on usePopupStore could be shared so future useSyncedFloatingRootContext changes land in one place.

Docs (2)

1. 🟡 AlertDialog Handle docs weren't brought in line with the Dialog/Drawer rewrite

Location: packages/react/src/alert-dialog/handle.ts:4-7 → generated docs/src/app/(docs)/react/components/alert-dialog/types.md:369

Drawer was matched to Dialog's new wording, but AlertDialog kept the legacy "A handle to control an Alert Dialog imperatively…" blurb, and its contract sentence only says calls before attach are ignored:

Calls made before the root is attached to the handle are ignored; the root owns fresh state when it mounts.

Dialog/Drawer correctly state "…before a root attaches (or after it unmounts) are ignored." — and the methods are no-ops whenever attachedStore === null, which includes after unmount. Rewrite the AlertDialog JSDoc to the Dialog/Drawer pattern (including "or after it unmounts") and run pnpm docs:api.

2. ℹ️ The new page.mdx paragraphs understate the contract (before-attach only)

Location: docs/src/app/(docs)/react/components/dialog/page.mdx:198 (and alert-dialog:103, drawer:220)

Calls made before the root is attached to the handle are ignored; the root owns fresh state each time it mounts.

Calls after the root unmounts are equally ignored — and the new unmount-remount experiment exists precisely to exercise the post-unmount case. Consider "Calls made while no root is attached — before one mounts or after it unmounts — are ignored."

Verdict

Approve after nits — no correctness regressions (all suites, typecheck, and lint green; the ownership change is sound), but several 🟡 polish items worth addressing before merge: the silent imperative-before-attach footgun, the spurious-warning/untested multi-root path, the weakened AlertDialog invariant assertions, and the AlertDialog doc inconsistency.


🤖 Review generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e43f5c5378

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@michaldudak

Copy link
Copy Markdown
Member Author

Imperative calls before a root attaches are silently dropped, with no production diagnostic

This shouldn't be a real issue. I included a dev-time warning for now. If it's a problem, I'll introduce a solution but I don't want to bloat the implementation now.

Minor breaking change: Handle constructors no longer accept a store argument

Handles are meant to be created with the createHandle factory method (as documented) - nothing changed there.

Cross-family inconsistency with Menu/Popover/Tooltip/PreviewCard

This will be addressed in a separate PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7726a20f15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

DialogHandle.open(triggerId) resolved the trigger element only from the attached root's store, so an open-by-id called from a layout effect in the same commit a root first attaches missed a still-mounted detached trigger that had not yet re-registered into the root store. The dialog opened unassociated and, with multiple detached triggers, another trigger could claim the popup first. Also resolve from the fallback store, where detached triggers stay registered until they migrate.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77fcd57223

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d0126cb68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

(element: Element | null) => {
baseRegisterTrigger(element);
if (element) {
applyTriggerData(element);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid claiming unassociated opens during migration

When a detached trigger re-registers because its handle store pointer changed, this also reapplies trigger data. If the root was opened imperatively without a trigger before the detached triggers have migrated (for example handle.open(null) or openWithPayload() from a layout effect in the same commit that the root attaches), activeTriggerId is still null and open is true, so applyTriggerData claims the first migrating trigger and can overwrite an openWithPayload() payload with the trigger's payload. That makes an explicitly unassociated imperative open become trigger-associated only during root attach/remount timing.

Useful? React with 👍 / 👎.

@flaviendelangle flaviendelangle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR review

This PR reworks dialog/alert-dialog/drawer store ownership so each Root owns its store (via useRefWithInit) and the handle attaches/detaches as roots mount — fixing the stale-open-state-on-remount bug (#4951). After a four-area fan-out (bugs, tests, simplifications, docs), verifier passes, and an independent sweep, nothing is merge-blocking: no 🔴 regressions. The store-construction path faithfully reproduces the deleted useOnFirstRender initial-open / alert-dialog-invariant logic, attach/detach stack handling is correct under clean handoff, canceled overlap, and StrictMode replay, and trigger migration follows standard callback-ref semantics. The actionable items are test-quality nits.

Bugs (0)

No findings.

For completeness, the only candidate that survived to a note is dev-only and self-correcting: in packages/react/src/dialog/store/DialogHandle.ts:182, the lazily-created overlapWarningFrame is never cancelled on attachStore cleanup. This is benign — AnimationFrame.create() instances coalesce (request() calls this.cancel() first, so at most one pending frame), and the deferred callback re-checks this.attachedStores.length > 1 at fire time, so a settled handoff never warns spuriously. Gated behind NODE_ENV !== 'production', no user impact.

Tests (2)

1. 🟡 Weak warning assertion in the handle-switch test

Location: packages/react/src/dialog/root/DialogRoot.detached-triggers.test.tsx:1766

consoleWarn.mockClear();
await act(() => handleB.open('a'));
// ...
expect(aTrigger).toHaveAttribute('aria-expanded', 'false');
expect(consoleWarn).toHaveBeenCalled();

After mockClear(), expect(consoleWarn).toHaveBeenCalled() only asserts that some warning fired, not the specific "No trigger found with id" message from DialogHandle.open. The behavioral assertion (aria-expanded === 'false') does pin the real contract, so the test isn't worthless, but the warning check itself is loose.

Failure scenario: if open-by-id regressed to emit an unrelated warning (e.g. an overlap warning) while still failing to associate the trigger, this assertion would still pass.

Fix: filter for the message, matching the other warning assertions in this file: expect(consoleWarn.mock.calls.some((c) => String(c[0]).includes('No trigger found'))).toBe(true).

2. 🟡 AlertDialog suite omits the detached no-op and payload-reset coverage that Dialog/Drawer have

Location: packages/react/src/alert-dialog/root/AlertDialogRoot.test.tsx:649

The Dialog and Drawer suites both assert (a) payload resets on remount and (b) the three "no root using this handle is mounted" warnings plus handle.isOpen === false while detached. The AlertDialog remount test asserts neither.

Failure scenario: a regression specific to AlertDialog's reset path (dropped payload-clearing, or imperative calls throwing/opening instead of no-op-warning while detached) would not be caught in the AlertDialog suite. Mitigated because AlertDialogHandle shares the exact DialogHandle code path that is covered in the Dialog file — so this is a coverage-parity nit, not a hole.

Fix: add a detached-imperative-no-op assertion and a payload-reset assertion to the AlertDialog remount test, mirroring the Dialog suite.

Additional ℹ️ gaps (optional): no test combines defaultOpen/defaultTriggerId with a handle-backed root (the useRefWithInit init path is covered by non-handle roots, and attach happens after init, so risk is low); the "payload dropped while detached" behavior is asserted only indirectly (the dropped value is never positively checked as absent on a later open); and the core remount-resets-state tests don't run under <React.StrictMode> (only the overlap path does).

Simplifications (1)

1. ℹ️ useDialogRootStore duplicates the floating-context setup from usePopupStore

Location: packages/react/src/dialog/root/useRenderDialogRoot.tsx:84 vs packages/react/src/utils/popups/popupStoreUtils.ts:51

useDialogRootStore re-implements useId + useFloatingParentNodeId + useSyncedFloatingRootContext + store creation almost verbatim from usePopupStore. usePopupStore is not dead — popover, tooltip, and preview-card still use it — so this can't be a delete. The two genuinely diverge in ownership model (usePopupStore is built around externalStore ?? createInternal; the new hook always owns the store and the handle attaches to it), so calling usePopupStore directly here would be more convoluted, not less.

Failure scenario: the floating-root wiring now lives in two places; a future change to it must be made twice. Low urgency — the duplicated surface is ~15 lines and the contracts legitimately differ. If addressed, extract just the useId/useFloatingParentNodeId/useSyncedFloatingRootContext block into a shared helper both call.

(The NullStore generic for one call site, the as any lazy-dev-field, the PopupTriggerDataStore Pick type, and the handle nominal brands were all reviewed and judged consistent with existing codebase precedent — no action needed.)

Docs (0)

No findings. The generated types.md files match source JSDoc, the removed store constructor param is fully scrubbed from all three components' types.md and the page.mdx index, the previous drawer copy-paste errors ("Dialog.Root…" → "Drawer.Root…", Drawer.Handle<Payload> prop type) are fixed, and the new "imperative methods require a mounted root" paragraph is consistent and accurate across dialog/alert-dialog/drawer. The author ran pnpm docs:api.

Verdict

Approve after nits — no regressions or correctness bugs; the only actionable items are two test-quality 🟡 nits (a loose warning assertion and AlertDialog coverage parity) and one ℹ️ duplication note.


🤖 Review generated with Claude Code

Assert the specific "No trigger found" message from DialogHandle.open instead of just toHaveBeenCalled(), matching the message-filtered warning checks elsewhere in the file, so an unrelated warning can't satisfy it.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@michaldudak

Copy link
Copy Markdown
Member Author

Weak warning assertion in the handle-switch test

Updated.

AlertDialog suite omits the detached no-op and payload-reset coverage that Dialog/Drawer have

Ignored. The logic in AlertDialog is basically the same as in the Dialog.

useDialogRootStore duplicates the floating-context setup from usePopupStore

I'll clean it up when I treat Menu and Popover the same way.

@michaldudak
michaldudak merged commit 16685b2 into mui:master Jun 30, 2026
6 checks passed
@michaldudak
michaldudak deleted the dialog-reset-on-unmount-handcrafted branch June 30, 2026 11:25
arturbien added a commit to whopio/frosted-ui that referenced this pull request Aug 6, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Summary

Upgrades `@base-ui/react` from `^1.6.0` → `^1.7.0` (latest as of Aug 4,
2026).

No Frosted UI source changes were required. Validated locally:
- `tsc` (CJS + ESM) ✅
- `eslint` + `stylelint` ✅
- `vitest` — 312/312 tests passing ✅

Sources: [Base UI v1.7.0 release
notes](https://base-ui.com/react/overview/releases/v1-7-0), [GitHub
release](https://github.com/mui/base-ui/releases/tag/v1.7.0),
[CHANGELOG](https://github.com/mui/base-ui/blob/master/CHANGELOG.md).

---

## Breaking changes

**Official changelog marks no 🚨 breaking changes in v1.7.0.**

However, there are behavioral, API, and type changes consumers (and
Frosted UI wrappers) should be aware of:

### Behavioral / DOM changes (potentially breaking in practice)

1. **`Accordion.Root` no longer sets an implicit `dir` attribute**
([#5117](mui/base-ui#5117))
- Previously `Accordion.Root` wrote `dir` onto the root. Direction now
comes from the document / ancestor only.
- Impact: CSS/JS that depended on `Accordion.Root[dir]` may stop
matching. Pass `dir` explicitly if needed.

2. **`Combobox.Input` / `Autocomplete.Input` no longer inject
`type="text"`** ([#5104](mui/base-ui#5104))
- Native `<input>` still defaults to text, but the attribute is no
longer present in the DOM.
- Impact: selectors like `input[type="text"]` will no longer match
unless `type="text"` is passed explicitly.

3. **Listbox separators use `role="presentation"`**
([#5399](mui/base-ui#5399))
- `Select.Separator`, `Combobox.Separator`, and `Autocomplete.Separator`
no longer expose `role="separator"` (axe/ARC compliance).
- `Select.Separator` switched from a re-export of the generic
`Separator` to a dedicated listbox separator component.
   - Public props (`orientation`, etc.) are preserved.

4. **Checkbox Group / Radio Group form values aligned with native
submission** ([#5218](mui/base-ui#5218),
[#5238](mui/base-ui#5238))
- Form payload shape may change vs prior Base UI behavior. Verify any
custom form serialization that assumed the old values.

5. **Popup / overlay remount + handle reuse**
- Dialog, Alert Dialog, Drawer, Menu, Popover, Preview Card, Tooltip no
longer reopen after remounting with a reused handle
([#5109](mui/base-ui#5109),
[#5149](mui/base-ui#5149)).

6. **Disabled state inheritance**
- `Combobox.Item` / `Select.Item` inherit disabled from Root
([#5365](mui/base-ui#5365)).
- `Menu` propagates disabled state to items
([#5363](mui/base-ui#5363)).

7. **`Field` keeps invalid state when disabled**
([#5116](mui/base-ui#5116)).

8. **`Select` no longer force-mounts the popup on programmatic value
changes** ([#5119](mui/base-ui#5119)).

### API additions / changes

| Area | Change |
|---|---|
| Autocomplete / Combobox | New `ChangeEventReason` values:
`"input-press"`, `"cancel-open"`
([#5356](mui/base-ui#5356),
[#5376](mui/base-ui#5376)) |
| Autocomplete | New `form?: string` prop on Root (associates the
internal input with an external form) |
| Combobox | Exposes `aria-expanded` / expanded behavior for inline
comboboxes ([#5332](mui/base-ui#5332)) |
| Combobox / Autocomplete | New `.Separator` part |
| Select | Dedicated `.Separator` part (listbox-safe semantics) |
| Toast | `render` prop content now works on `Toast.Title`,
`Toast.Description`, `Toast.Action`
([#5210](mui/base-ui#5210)) |
| Modal docs | Touch-device modal scroll behavior clarified for Combobox
/ Select |

### Type changes

1. **`render` callback props specialized to the rendered element**
([#5104](mui/base-ui#5104))
- Third generic of `BaseUIComponentProps` now types callback props as
the intrinsic element for:
     - `Avatar.Image` → `'img'`
     - `Form` → `'form'`
     - `NumberField.Input` / `OTPField.Input` → `'input'`
- `PreviewCard.Trigger` / `Menu.LinkItem` / `NavigationMenu.Link` /
`Toolbar.Link` → `'a'`
- Polymorphic parts (e.g. `Combobox.Input`, `Field.Control`, button
parts via `nativeButton`) remain loosely typed as `HTMLProps`.
- May surface new TS errors if a `render` callback assumed looser props
(or the reverse: more precise props like `src`/`href` are now
available).

2. **Implementation-only types stripped from published `.d.ts`**
([#5165](mui/base-ui#5165))
   - `@internal` declarations are no longer emitted.
- Deep imports of internals (e.g. previously published helpers like
`FloatingFocusManager`, `useAnchorPositioning`, numeral utils, store
helpers) will fail typechecking if used.
   - Frosted UI does not depend on these internals.

3. **`AutocompleteRootChangeEventReason` /
`ComboboxRootChangeEventReason` union widened**
- Adds `"input-press"` and `"cancel-open"`. Exhaustive `switch`/`if`
chains over reasons may need updates.

4. **Internal path moves** (only relevant for deep imports)
- e.g. `useAnchorPositioning` moved under `internals/`; several utils
relocated/removed from the public declaration graph.

### Frosted UI impact assessment

| Concern | Status |
|---|---|
| Compile / typecheck against 1.7.0 | Passes with no source edits |
| Existing `DialogRootActions` / `AlertDialogRootActions` imports |
Still exported |
| `useRender` / `mergeProps` | Unchanged public surface |
| Autocomplete `keepHighlight` stories | Still valid (Autocomplete
retains the prop; Combobox had removed it earlier in 1.6) |
| Select.Separator wrapper | Compatible; benefits from a11y role fix
automatically |

---

## What's new in `@base-ui/[email protected]`

### Features / enhancements
- Typed `render` callback props based on the rendered element
- Autocomplete locale-aware filtering
- Autocomplete `form` prop for associating an external form
- New Combobox / Autocomplete / Select listbox `Separator` parts
(presentation role)
- Combobox inline `aria-expanded` exposure
- New open-change reasons: `input-press`, `cancel-open`
- Scroll Area WebKit overscroll feedback on Thumb
- Avatar Fallback shows immediately when `delay={0}`
- Toast `render` prop support on Title / Description / Action

### Fixes (high level)
- Popup positioning: collision padding off-by-one, unwanted flip with
capped scrollable content, left-anchored auto-resize origin,
unpositioned popups at viewport origin, canceled-exit unmount completion
- Focus restoration after keyboard close in Safari/Firefox
- Dialog touch outside-press without backdrop; scroll-lock handoff with
external overlays
- Drawer swipe/open reliability, iOS cross-axis scroll, Shadow DOM
gestures, virtual keyboard scroll
- Menu/submenu: duplicate `onOpenChange`, VoiceOver, TalkBack,
pinch-zoom, Chrome mouseleave
- Combobox/Select highlight/filter/scroll fixes (Safari hover highlight,
grouped limit, query clear, disabled inheritance)
- Field `data-dirty` for null-valued controls; Form focuses first
invalid field in document order
- Number Field multi-character format symbol editing
- Progress custom `min`/`max` semantics
- Slider assorted fixes; Tabs Suspense pre-hydration indicator
- Toast timer / swipe / re-add / provider effect ordering
- Navigation Menu frozen state when open trigger unmounts
- Radio unnecessary ARIA attributes removed; internal input clicks no
longer bubble (Checkbox/Switch/Radio)

### Performance / bundle size
Across many components Base UI reduced parsed bundle size and avoided
redundant work:
- Shared popup / store / dialog / popover / field / form / meter /
progress / scroll-area / slider / switch / tabs / toast / toolbar /
toggle-group size reductions
- Avoid redundant re-renders during lazy flipping
- Remove redundant lifecycle synchronization
- Exclude prehydration scripts from client bundles (Slider, Tabs)
- Deduplicate Combobox/Select/Autocomplete handlers and swipe math

---

## Full v1.7.0 changelog (from upstream)

### General
- Restore visible focus after keyboard close in Safari and Firefox
(#5093)
- Type `render` callback props based on the rendered element (#5104)
- Reduce popup / store / shared popup bundle size (#5233, #5250, #5192)
- Keep unpositioned popups at the viewport origin (#5299)
- Correct layout and passive effect timing (#5337)
- Remove redundant lifecycle synchronization (#5341)
- Prevent stale cleanup from clearing registered part IDs (#5340)
- Complete popup unmounting after a canceled exit transition (#5401)
- Fix rendered trigger ID ownership (#5110)
- Prevent unwanted flip with capped scrollable content (#5120)
- Fix `collisionPadding` off-by-one on the biased side (#5143)
- Mount popup subtrees synchronously when opening in React 17 (#5309)
- Fix auto-resize origin for left-anchored popups (#5370)
- Avoid redundant re-renders during lazy flipping (#5372)
- Strip implementation-only types from published `.d.ts` files (#5165)
- Fix `usePreviousValue` equality comparison (#5264)

### Components
- **Accordion:** Remove implicit `dir` on Root (#5117)
- **Alert Dialog / Dialog / Drawer / Menu / Popover / Preview Card /
Tooltip:** Prevent reopen after remount with reused handle (#5109,
#5149)
- **Autocomplete:** Locale filtering; `input-press` / `cancel-open`
reasons; reset scroll on filter; separator semantics
- **Avatar:** Fallback immediate at `delay={0}`
- **Button:** Keyboard click for custom elements
- **Checkbox / Checkbox Group / Switch / Radio Group:** Click bubbling,
validation, native form values, bundle size
- **Combobox:** Filtering/highlight fixes; `expanded` for inline;
disabled inheritance; separator; portalled content; bundle cleanup
- **Composite:** Nested reorder, disabled nav skip, RTL scroll alignment
- **Drawer:** Swipe/open, iOS scroll, Shadow DOM, snap points, bundle
- **Field / Fieldset / Form:** Invalid-when-disabled, `data-dirty`,
focus first invalid, bundle
- **Menu:** Pinch-zoom, submenu hover/VO/TalkBack, disabled propagation,
exit animation
- **Meter / Progress / Toggle Group:** Formatting / min-max / bundle
- **Navigation Menu:** Frozen menu on trigger unmount; pinch-zoom
- **Number Field / OTP Field:** Format symbols; invalid autofocus when
autoSubmit blocked
- **Scroll Area:** Thumb drag, iOS visibility, overscroll feedback, snap
while dragging
- **Select:** Highlight/disabled/mount/separator fixes
- **Slider / Tabs:** Assorted fixes; Suspense indicator; exclude
prehydration from client bundles
- **Toast:** Timer, swipe locking, re-add closing toast, `render` prop
content, provider effect order

---

## Test plan

- [x] Bump `@base-ui/react` to `^1.7.0` and refresh lockfile
- [x] `pnpm --filter=frosted-ui exec tsc --project tsconfig-esm.json
--noEmit`
- [x] `pnpm --filter=frosted-ui build:js` (CJS + ESM)
- [x] `pnpm --filter=frosted-ui lint`
- [x] `pnpm --filter=frosted-ui test` (312 tests)
- [ ] CI green on this PR
- [ ] Spot-check Storybook surfaces that wrap Base UI heavily (Combobox,
Select, Dialog, Menu, Toast, Accordion) if desired before merge

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-b799cb20-62b5-4aad-9033-e9e7a838d771?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-b799cb20-62b5-4aad-9033-e9e7a838d771&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <[email protected]>
legowhales added a commit to legowhales/svelte-base-drawer that referenced this pull request Aug 13, 2026
Ports the six applicable Drawer fixes from the base-ui v1.7.0 release:

- mui/base-ui#5105: reliable swipe-to-open — first-move re-anchoring is now
  gated on trackDrag (the SwipeArea passes trackDrag: false, so a flick whose
  whole travel lands in the first move still registers), and
  sawPrimaryButtonsOnMove initializes from the event type.
- mui/base-ui#5308: drag styles are only rewritten when the offset actually
  changed, fixing the snap point jump when the pointer is pinned at a screen
  edge. The swipeThreshold function is snapshotted at gesture start.
- mui/base-ui#5257: cross-axis touch arbitration rewritten
  (shouldYieldTouchMove) — 6px slop / 2px bias, one-shot attribution per
  gesture, non-cancelable moves yield to native scroll, and no preventDefault
  until an axis passes the slop (iOS kills native scrolling for the whole
  gesture otherwise).
- mui/base-ui#5360: elementFromPoint resolves through getRootNode() so swipe
  gestures work inside shadow DOM.
- mui/base-ui#5112: the popup no longer flashes fully open for a frame during
  a swipe-area open — resetAfterOpen skips the movement-var reset while the
  SwipeArea drives the gesture (swipeAreaActive), and the SwipeArea re-asserts
  its styles when the popup (re)mounts.
- mui/base-ui#5179: virtual keyboard scroll handling rework for focus moves
  while the keyboard is open — interval realign passes, preemptive focus
  geometry override to neutralize WebKit's reveal scroll, window scroll
  pinning, programmatic-focus flag, settle-watching scroll bookkeeping.

The SwipeArea outside-press guard is now deterministic (capture-phase
pointerdown/click listeners + isVirtualClick) instead of a 300ms timer.

Not ported (React-only): mui/base-ui#5109, Drawer.Handle/createHandle
detached triggers, bundle-size refactors.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: alert dialog Changes related to the alert dialog component. component: dialog Changes related to the dialog component. component: drawer Changes related to the drawer component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dialog] dialog with createHandle survives navigation and preserve pre-navigation store state

3 participants