mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Let input
JS event be dispatched by keydown
instead of keypress
(#37078)
1. Let `input` JS event be dispatched by `keydown` instead of `keypress`, according to spec 2. Fire `input` event for Backspace and Delete. But do so only when something is actually deleted Testing: Manually tested and compared with other browsers. Fixes: #37051 cc @xiaochengh Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
8ebf344e5e
commit
45072ae2e0
4 changed files with 51 additions and 28 deletions
|
@ -2374,6 +2374,9 @@ impl Document {
|
|||
let mut cancel_state = event.get_cancel_state();
|
||||
|
||||
// https://w3c.github.io/uievents/#keys-cancelable-keys
|
||||
// it MUST prevent the respective beforeinput and input
|
||||
// (and keypress if supported) events from being generated
|
||||
// TODO: keypress should be deprecated and superceded by beforeinput
|
||||
if keyboard_event.state == KeyState::Down &&
|
||||
is_character_value_key(&(keyboard_event.key)) &&
|
||||
!keyboard_event.is_composing &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue