[Bug Fix] Dialog: keep closed native <dialog> hidden and sync docs controller (#343)#458
Merged
Merged
Conversation
…ntroller (#343) The native-<dialog> migration in #343 left two gaps that made dialogs render open by default in production: 1. DialogContent used a bare `flex` utility. Author CSS overrides the user-agent `dialog:not([open]) { display: none }` regardless of specificity, so a closed <dialog> was forced visible. Gate the layout on the open: variant (`open:flex`) so a closed dialog falls back to the UA display:none. 2. The docs app bundles its own copy of the Stimulus controller, which was never updated to the native-dialog version and still referenced the removed `content` target (console: "Missing target element content"), so triggers threw instead of opening the modal. Sync it with the gem's controller (dialogTarget / showModal / backdropClick). Also adds a regression test and rebuilds the MCP registry. Verified in a real browser against a local docs build: closed dialogs are hidden, the trigger opens a native modal (backdrop + scroll lock), and closing restores display:none. No console errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cirdes
approved these changes
Jul 1, 2026
djalmaaraujo
added a commit
that referenced
this pull request
Jul 1, 2026
Bump RubyUI to 1.5.0 (minor: new components since v1.4.0). - gem/lib/ruby_ui.rb → 1.5.0; regenerate gem/ and docs/ Gemfile.lock - docs home hero badge → headline features (Bubble, Message, Empty) - rebuild mcp/data/registry.json Highlights since v1.4.0: - New components: Bubble (#445), Message (#446), Message Scroller (#447), Empty (#448) - Port hover_card & context_menu to Floating UI, drop Popper.js (#438) - Bug fixes: Dialog closed-state + docs controller (#458), DropdownMenu z-index (#440)
djalmaaraujo
added a commit
that referenced
this pull request
Jul 1, 2026
Bump RubyUI to 1.5.0 (minor: new components since v1.4.0). - gem/lib/ruby_ui.rb → 1.5.0; regenerate gem/ and docs/ Gemfile.lock - docs home hero badge → headline features (Bubble, Message, Empty) - rebuild mcp/data/registry.json Highlights since v1.4.0: - New components: Bubble (#445), Message (#446), Message Scroller (#447), Empty (#448) - Port hover_card & context_menu to Floating UI, drop Popper.js (#438) - Bug fixes: Dialog closed-state + docs controller (#458), DropdownMenu z-index (#440)
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.
Problem
After #343 migrated Dialog to the native
<dialog>element, dialogs render open by default on https://www.rubyui.com/docs/dialog (and for any gem consumer). The migration left two gaps:DialogContentused a bareflexutility. Author-origin CSS overrides the user-agent ruledialog:not([open]) { display: none }regardless of specificity, so a closed<dialog>was forced visible (shown centered, no backdrop, page behind not inert — i.e. not actually a modal).contenttarget. Console showedMissing target element "content", so triggers threw instead of opening the modal.Fix
gem/lib/ruby_ui/dialog/dialog_content.rb:flex→open:flex(layout applies only when[open]; a closed dialog falls back to the UAdisplay:none).docs/app/javascript/controllers/ruby_ui/dialog_controller.js: synced with the gem's native-dialog controller (dialogTarget/showModal/backdropClick).gem/test/ruby_ui/dialog_test.rb: regression test assertingopen:flex(and no bareflex).mcp/data/registry.json: rebuilt.Testing
cd gem && bundle exec rake→ 264 runs, 0 failures + StandardRB clean.Verified in a real browser against a local docs build (
pnpm build && pnpm build:css)::modaltrue) ✅display:none✅Missing target element "content") ✅Fixes the regression from #343. Recommend a patch release.
🤖 Generated with Claude Code
Summary by cubic
Fixes the native regression so closed dialogs stay hidden and docs triggers open a real modal again. Updates gem CSS and syncs the docs Stimulus controller with the native-dialog API.
DialogContent: gate layout withopen:flexinstead offlexso closed dialogs fallback to UAdisplay:none.dialogtarget, useshowModal/close, handle backdrop clicks, and clear body scroll lock on close.open:flex; rebuildmcp/data/registry.json.Written for commit beef90c. Summary will update on new commits.