Repository navigation
Diagrams: a viewer opened from a modal is usable (written into the modal's popup) - #145
Merged
Merged
Conversation
…l's popup CIMIP's document reader is a form DialogContent; "Expand" there opened the viewer, a native <dialog> (showModal) portalled to the end of the body, and every control in it was dead (Close, the zoom, Fit, View as list, the app's actions; Playwright saw .basalt-diagram-viewer-end take the clicks). The cause: the open modal's guard (modal-outside.ts, guardOutside) watches the body for anything added outside its popup and makes every control in it inert, and the viewer arrived as a new child of the body. Inert buttons are not hit-tested, so a press landed on the row around them; only Esc worked, because the browser's cancel goes to the <dialog> itself, which is not a control. Base UI's own marks are applied once at open and did not reach it. The fix: a context (layers.ts, ModalHost), set by Dialog, AlertDialog, Sheet and CommandMenu to their popup and read by the figure, which hands it to the viewer; the viewer is written into that popup, and on the page into the body as before. Inside the popup it is inside the modal for the guard, for Base UI's outside press and for its focus trap; a showModal dialog draws in the top layer wherever it sits. In a modal, Esc stops at the viewer (the modal's dismissal listens on its popup and the document), so it closes the viewer alone, and the viewer closes as its modal starts to close (data-closed), so the two leave together and the modal can return focus to its trigger. On the page nothing changes. Engineering, a bug fix restoring documented behaviour: no panel. test/diagram-viewer-in-dialog.test.mjs is written and not run (DECISIONS 359). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bmjcoding
added a commit
that referenced
this pull request
Nov 25, 2026
…e regenerated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes a bug CIMIP's lead found while adopting
1890615e: a diagram viewer opened from inside a modal BasaltDialogwas inert. Close, zoom, Fit, View as list and the app's actions were all dead, and only Escape closed it.The cause:
useModalOutside's guard (modal-outside.ts). While a modal is open, it makes every control added outside the modal's popupinert. The viewer is a native<dialog>, and it was portaled onto the body after the modal had opened, so it landed outside the popup.The fix:
layers.tsgets aModalHostcontext, the nearest Basalt modal's popup. Dialog, AlertDialog, Sheet and CommandMenu provide it, and the figure passes it to the viewer, which is portaled into that popup. AshowModaldialog still draws in the top layer.data-closed), so it never holds the parent's trigger inert.Review: engineering, a bug fix restoring documented behaviour, so no panel; no pixel changes. The builder checked this: all 341 elements of the viewer have the same boxes and computed styles in a form Dialog as on the page, in both themes.
Checks:
diagram-viewer-in-dialog.test.mjsis written, not run.scripts/chromium-launch.mjs, from a Dialog, a Sheet and an AlertDialog. Everything worked:Sizes: 14 exports grow 58 to 61 bytes (+0.1%). The package grows 197 bytes minified, 16 gzipped.
The skill's viewer: it doesn't have this bug, because it uses native modals only and nothing makes the outside inert. That was found by reading the code; it wasn't run.
🤖 Generated with Claude Code