Description
Cuprite sends custom keydown events to the node when using, e.g., fill_in
here: https://github.com/rubycdp/cuprite/blob/main/lib/capybara/cuprite/javascripts/index.js#L192-L196
We're using Stimulus.js in our application, and using an action with a filter like keydown.esc->controller#cancel
(which should trigger when pressing the escape key only), this interferes with Cuprite as it checks only for the key
property, which with Cuprite refers to a number. https://github.com/hotwired/stimulus/blob/main/src/core/action.ts#L62
This results in the filter not matching and during a test written with Cuprite, the action to be triggered regardless of the key.
keyCode is deprecated and key
is commonly supported in all browsers. Cuprite should set the key with the original pressed key (however it seems there is some logic behind setting the key value). https://caniuse.com/?search=event.key
I can submit a PR for that, but I'm still looking for how to actually set the key
property correctly when creating a custom event.