rgossiaux / svelte-headlessui

Unofficial Svelte port of the Headless UI component library
https://svelte-headlessui.goss.io
MIT License
1.78k stars 96 forks source link

Can we prevent keyboard capture in Disclosure? #105

Open sureshjoshi opened 2 years ago

sureshjoshi commented 2 years ago

Is there any way to catch keyboard events in a DisclosureButton? By default, it captures the Enter and Spacebar to open/close the Disclosure, however, I have an input field that is occasionally used in the DisclosureButton, but whenever I press Spacebar or Enter, those the disclosure opens/closes, but the keyboard events aren't passed to the input.

I'm able to workaround by adding a disable to the DisclosureButton when I'm editing the input - but I was wondering if there was any other way? Or, is this just an unsupported, breaking functionality I'm trying to add?

It's just a hacked prototype right now, so not a big deal, but I'm curious if there is another way around this.