Dialog: clicking the panel's inner padding closes it (backdropClick matches the <dialog> itself)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- html, javascript, ruby
- Domain
- frontend
Research direction
Start with dialog_controller.js and inspect backdropClick, which currently dismisses when the event target is the dialog. Reproduce by clicking the panel padding or a gap between form fields, then check the suggested rectangle-based approach and its keyboard-click caveat. Done means clicks inside the panel leave it open while backdrop clicks still dismiss it.
Written by the indexing model from the issue text.
Description
Bug
Dialog closes when the user clicks the empty padding inside the panel, not only the backdrop.
DialogContent renders a native <dialog> with p-6 and gap-4, and dialog_controller.js dismisses on any click whose target is the <dialog> itself:
backdropClick(e) {
if (e.target === this.dialogTarget) {
this.dismiss()
}
}
A click on the ::backdrop and a click on the panel's own padding (or the gaps between children) both report e.target === dialog, so both close the dialog.
Reproduce
- Open any
Dialog(e.g. one with a form inside). - Click inside the panel, in the padding area or between two fields — not on a child element.
- The dialog closes.
Seen on main (b96aaf3); #517 keeps backdropClick as is.
Suggested fix
Only dismiss when the pointer is outside the panel's rectangle:
backdropClick(e) {
if (e.target !== this.dialogTarget) return
const rect = this.dialogTarget.getBoundingClientRect()
const outside = e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom
if (outside) this.dismiss()
}
(Keyboard-triggered clicks report clientX/clientY of 0, which falls outside the rect only when the dialog isn't at the top-left corner — worth guarding with e.detail === 0 if that matters.)
- Dominant language
- Ruby
- Stars
- 1k
- Forks
- 68
- Avg merge
- 17h 45m
- Merged PRs (30d)
- 17
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby-ui/ruby_ui
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
glossarist/glossarist-ruby#247 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
🐛 bug 🧑💼 conseillers
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
betagouv/conseillers-entreprises#4768 ·
Maintainers usually reply within 1 day
-
`github-events` aborts the repository scan when a closed pull's API payload has a null `head`Possibly taken @renyamamoto2026-cmyk claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zerocracy/judges-action#2823 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day