You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`root`|`HTMLElement \| null \| React.RefObject<HTMLElement \| null>`|`document.body`| Container element to portal into |
76
78
77
-
When `root` is provided, the dialog is "scoped" to that container: `Dialog.Backdrop` skips `FloatingOverlay` (no fixed positioning or scroll lock), and consumers handle positioning via CSS on the container.
79
+
When `root` is provided, the dialog is portaled into that container instead of `document.body`. Consumers handle layout via CSS on the container (or by omitting `Dialog.Viewport` and styling their own).
|`data-cl-slot`| All parts | Part identifier (e.g. `"dialog-popup"`) |
103
+
|`data-cl-open` / `data-cl-closed`| Trigger, Backdrop, Viewport, Popup| Open state |
102
104
103
105
## Important Notes
104
106
105
-
-**`Dialog.Popup`must be a child of `Dialog.Backdrop`.** The backdrop hosts the portal, overlay, and focus manager — the popup alone does not handle these.
107
+
-**`Dialog.Popup`should be a child of `Dialog.Viewport`**for centered, scroll-locked modal behavior. The viewport hosts the fixed overlay container; the popup alone does not handle positioning or scroll lock.
106
108
-**Title and Description are optional but recommended.** If omitted, `aria-labelledby` / `aria-describedby` are simply absent from the popup.
107
109
-**Nested dialogs are supported.** The `FloatingTree` pattern handles nesting automatically.
108
110
-**No positioning middleware.** Dialogs are centered via CSS, not Floating UI positioning.
109
111
112
+
## Authoring rule for new primitives
113
+
114
+
Each styleable surface = one part. Layout infrastructure (overlay, scroll lock, focus manager, portal) wraps a `renderElement` call rather than fusing with it. The dialog split — `Backdrop` (semi-transparent surface) vs. `Viewport` (fixed centering + scroll lock) — exists because mosaic needs to style each layer independently. Apply the same decomposition to future primitives that combine positioning with a styled surface.
0 commit comments