Skip to content

[Bug Fix] Dialog: keep closed native <dialog> hidden and sync docs controller (#343)#458

Merged
cirdes merged 1 commit into
mainfrom
claude/compassionate-curie-795045
Jul 1, 2026
Merged

[Bug Fix] Dialog: keep closed native <dialog> hidden and sync docs controller (#343)#458
cirdes merged 1 commit into
mainfrom
claude/compassionate-curie-795045

Conversation

@djalmaaraujo

@djalmaaraujo djalmaaraujo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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:

  1. CSS (gem): DialogContent used a bare flex utility. Author-origin CSS overrides the user-agent rule dialog: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).
  2. JS (docs): 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 showed Missing target element "content", so triggers threw instead of opening the modal.

Fix

  • gem/lib/ruby_ui/dialog/dialog_content.rb: flexopen:flex (layout applies only when [open]; a closed dialog falls back to the UA display: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 asserting open:flex (and no bare flex).
  • 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):

  • Closed (default): dialogs hidden — only triggers visible ✅
  • Trigger click: opens a native modal (backdrop + body scroll lock, :modal true) ✅
  • Close: restores display:none
  • No console errors (previously threw 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.

  • Bug Fixes
    • DialogContent: gate layout with open:flex instead of flex so closed dialogs fallback to UA display:none.
    • Docs controller: switch to dialog target, use showModal/close, handle backdrop clicks, and clear body scroll lock on close.
    • Add regression test for open:flex; rebuild mcp/data/registry.json.

Written for commit beef90c. Summary will update on new commits.

Review in cubic

…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>
@djalmaaraujo djalmaaraujo requested a review from cirdes as a code owner July 1, 2026 19:33

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 4 files

Re-trigger cubic

@cirdes cirdes merged commit 430a233 into main Jul 1, 2026
8 checks passed
@cirdes cirdes deleted the claude/compassionate-curie-795045 branch July 1, 2026 19:37
@djalmaaraujo djalmaaraujo mentioned this pull request Jul 1, 2026
3 tasks
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants