CaptainCodeman / svelte-headlessui

HeadlessUI components for Svelte
https://captaincodeman.github.io/svelte-headlessui/
MIT License
529 stars 25 forks source link

include svgs in click outside propagation checks #64

Closed jamesbirtles closed 12 months ago

jamesbirtles commented 12 months ago

Having SVGs in the button for popover/menus etc would cause the detection for if you're clicking the button to fail, causing the popover to close then immediately reopen, effectively staying open.

This PR changes the instanceof HTMLElement check to instead check for instanceof Node which will include SVGElements and includes the only method currently used on the target which is .contains

This should fix #62

CaptainCodeman commented 12 months ago

Great, thanks!