Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Dialog: clicking the panel's inner padding closes it (backdropClick matches the <dialog> itself)

Open Beginner friendly
#570 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Open any Dialog (e.g. one with a form inside).
  2. Click inside the panel, in the padding area or between two fields — not on a child element.
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby-ui/ruby_ui

All issues in ruby-ui/ruby_ui

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.