w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
145 stars 52 forks source link

It's unclear whether initKeyboardEvent should clear CapsLock key state or not #209

Open rniwa opened 6 years ago

rniwa commented 6 years ago

The definition of initKeyboardEvent doesn't make it clear whether AltGraph key state and CapsLock key state should be reset or not because it's missing those arguments.

Note that WebKit takes altGraphKey modifier as an optional boolean argument after metaKey modifier boolean.

garykac commented 6 years ago

There's a similar issue with NumLock, where initKeyboardEvent doesn't allow for it to be specified.

And ScrollLock (which doesn't seem to be supported), Symbol and SymbolLock (I can't test the latter two). Those are the only other relevant modifier keys.

Because of this, there is currently no way to affect the result of getModifierState() for constructed events to include these modifiers.

Test page: https://w3c.github.io/uievents/tools/key-event-viewer.html

rniwa commented 6 years ago

Firefox & Chrome seem to clear caps lock state. We're going to match their behavior going forward: https://webkit.org/b/188909.