Skip to content

Commit

Permalink
Extend fix to elements with borders
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoTod committed Oct 9, 2021
1 parent 661027a commit 2272be1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/alpinejs/src/utils/on.js
Expand Up @@ -28,7 +28,11 @@ export default function on (el, event, modifiers, callback) {
handler = wrapHandler(handler, (next, e) => {
if (el.contains(e.target)) return

if (el.offsetWidth < 1 || el.offsetHeight < 1) return
if (el.offsetWidth < 1 && el.offsetHeight < 1) return

// Additional check for special implementations like x-collapse
// where the element doesn't have display: none
if (el._x_isShown === false) return

next(e)
})
Expand Down

0 comments on commit 2272be1

Please sign in to comment.