You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using on:keydown on a form element (or likely any input), the event is currently typed as leptos::ev::KeyboardEvent.
However, in the cause of input autocomplete (selecting a historic value from a browser suggestion), the event is actually a leptos::ev::Event, as there is no event.key(). This is a bit of an unfortunate browser quirk, at least in the latest chrome.
Is there a reason to think this might be a Chrome bug, or Chrome being spec-non-compliant? Comparison with other browsers would be good. The W3C UI Events spec is pretty explicit that keydown is a KeyboardEvent.
Yeah I'll be honest I'm not sure the best way to deal with this. From looking around a little, my impression is that this is a long-standing Chrome thing that will probably not change. On the other hand, it seems pretty clear to me that it's not compliant with the spec.
I guess there are three options:
In a future version, make keydown a KeyboardEvent, which will be a breaking change and be less useful for users in the default case (all other browsers, and all non-autocomplete keydown events)
Add some kind of runtime check, which will have a cost for all binary sizes and a runtime performance cost for the default case
Document "hey, this is broken in Chrome, here's the workaround if you encounter it"
When using
on:keydown
on a form element (or likely any input), the event is currently typed asleptos::ev::KeyboardEvent
.However, in the cause of input autocomplete (selecting a historic value from a browser suggestion), the event is actually a
leptos::ev::Event
, as there is noevent.key()
. This is a bit of an unfortunate browser quirk, at least in the latest chrome.Reference issue:
gaucho-labs/leptos-hotkeys#94
The text was updated successfully, but these errors were encountered: