qwik-ui
qwik-ui copied to clipboard
Use CloseWatcher API when supported in place of escape key handlers
This library should use the CloseWatcher API [1][2] in place of escape key listeners where it's supported. This allows components such as combobox to be dismissed using extra close signals (e.g. Android back gesture).
[1] https://html.spec.whatwg.org/multipage/interaction.html#the-closewatcher-interface [2] https://developer.chrome.com/blog/new-in-chrome-120#close-watcher
Native popover and dialog elements internally use this API so by supporting it Qwik-ui would better match the platform. It would also improve accessibility as Screen reader "close signals" such as Talkback's back gesture are also supported.
https://close-watcher-demo.glitch.me/ contains a polyfill that could be used. Alternatively you could choose to just branch your logic using close watcher where supported or using the existing escape key handlers where it's not.