vnphanquang / svelte-put

Useful svelte stuff to put in your projects
https://svelte-put.vnphanquang.com
MIT License
836 stars 25 forks source link

Change clickoutside node type to Element or Node to allow usage on SVG elements #246

Closed vnphanquang closed 1 year ago

vnphanquang commented 1 year ago

Discussed in https://github.com/vnphanquang/svelte-put/discussions/245

Originally posted by **vegeta897** November 17, 2023 Right now the `clickoutside` action can only be used on an `HTMLElement` without a type error. If you ignore the error and use it on, for example, a `` element inside an SVG, it appears to work perfectly. This is great for taking advantage of the precise hit zones of SVG shapes. I don't think any methods or properties in the `clickoutside` code require the node to specifically be an `HTMLElement`, but maybe I'm missing something. I propose broadening this type up to `Element` or `Node`. Is this something that could be considered? Thanks!