thisbeyond / solid-select

The Select component for Solid.
https://solid-select.com
MIT License
172 stars 18 forks source link

Select interfers with ninja-keys #46

Closed on3iro closed 1 year ago

on3iro commented 1 year ago

Hey,

I just tried out solid-ninja-keys and stumbled over an issue, where I could not use ninja-keys default keybindings. After narrowing it down, it turned out that solid-select somehow interferes with those bindings (tracking issue: https://github.com/wobsoriano/solid-ninja-keys/issues/1)

Any idea what could cause this and if there is an easy fix? Here is a reproduction of the issue on stackblitz: https://stackblitz.com/edit/solidjs-templates-dz5buc?file=src%2FApp.tsx

Thanks in advance

martinpengellyphillips commented 1 year ago

Hmm, I'm not seeing the issue there. The bindings appear to work for me. Note that the bindings won't work whilst the select has focus because it captures onkeydown, but that is to be expected.

on3iro commented 1 year ago

Huh, that's weird. cmd + k works for me, but everything else doesn't. I wonder why it works for you. (I did not focus the select) (tested inside chrome and firefox)

on3iro commented 1 year ago

@martinpengellyphillips we also checked the stackblitz on the computer of my wife (OSX as well) and the issue remains.

martinpengellyphillips commented 1 year ago

@on3iro please be clearer when reporting issues in future. I did not know from your original description that you were activating with cmd + k and then seeing an issue (I don't use solid-ninja-keys myself). With that additional context I am able to reproduce the issue.

However, replacing solid-select with a plain input and onKeyDown handler also presents the same issue. https://stackblitz.com/edit/solidjs-templates-cmuphr?file=src%2FApp.tsx

So I believe this is an issue with solid-ninja-keys. I imagine it relies on a library that uses dom event listeners directly and these may encounter issues when using solidjs delegated handlers (e.g. via something like onKeyDown).

-> "Solid uses semi-synthetic event delegation for common UI events that are composed and bubble."

on3iro commented 1 year ago

@martinpengellyphillips oh good point, sorry. I usually try to be very specific inside my issue descriptions, but definitely missed the mark here.

I'll close the issue and report back to solid-ninja-keys or probably. Thanks for taking a look into this!