New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 55 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature


Sign in to add a comment

KeyboardEvent does not match the latest specification

Project Member Reported by ch.du...@samsung.com, Jul 24 2013

Issue description

Blink's implementation of KeyboardEvent does not match the latest specification:
- http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent (W3C working draft)

Here is the detail of features and browsers support:
- 'location'
  * Supported by IE10 and FF15
  * Supported by Blink as 'keyLocation'
- 'key'
   * Supported by IE10 and FF (nightly [1])
   * Supported by Blink as 'keyIdentifier'
- 'char'
   * Supported by IE10
   * WIP for FF [1]
   * Not supported by Blink
- 'getModifierState()'
  * Supported by IE10 and FF15
  * Not supported by Blink
- 'repeat'
  * Supported by IE10
  * WIP for FF [2]
  * Not supported by Blink
- 'locale'
  * Supported by IE10
  * WIP for FF [3]
  * Not supported by Blink
- DOM_KEY_LOCATION_* constants
  * Supported by IE10 / FF15
  * Not supported by Blink

Support is good in IE10 and decent in Firefox [4]. Therefore, I think it is a good idea to support this functionality in Blink as well, at least the part that is supported by both IE10 and Firefox already.

Outdated attributes will be kept but marked as deprecated to avoid any breakage and so that we can track usage.

Related test cases:
- http://samples.msdn.microsoft.com/ietestcenter/domevents/domevents_harness.htm?url=KeyboardEvent.location.html
- http://samples.msdn.microsoft.com/ietestcenter/domevents/domevents_harness.htm?url=KeyboardEvent.modifiers.html
- http://samples.msdn.microsoft.com/ietestcenter/domevents/domevents_harness.htm?url=keyboardevent.key.html

Links:
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=680830
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=600117
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=680832
[4] https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
 

Comment 1 by tkent@chromium.org, Jul 24 2013

I recommend to post Intent to implement/ship mail to blink-dev before starting implementation.

Status: Assigned
Yes, I filed this bug to add the link to the intent to implement/ship email. The email is sent now BTW.

Comment 3 by w...@chromium.org, Jul 24 2013

Blocking: chromium:227231

Comment 4 by w...@chromium.org, Jul 24 2013

Cc: w...@chromium.org garykac@chromium.org
Note that 'key' is not simply a rename of 'keyIdentifier', but has different semantics, which are varyingly involved to implement correctly across the different platforms.

Also note that the 'char' attribute of 'keydown'/'keyup' is due to be replaced by the separate 'textInput' event (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22071).

Comment 6 by kochi@chromium.org, Jul 25 2013

Blockedon: chromium:168971
Cc: kochi@chromium.org yoichio@chromium.org
Labels: Cr-UI-Input-Text
For .locale, please refer to  issue 168971  for discussion.
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 30 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155158

------------------------------------------------------------------------
r155158 | ch.dumez@sisa.samsung.com | 2013-07-30T10:49:59.037697Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/KeyboardEvent.cpp?r1=155158&r2=155157&pathrev=155158
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-getModifierState-expected.txt?r1=155158&r2=155157&pathrev=155158
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/KeyboardEvent.idl?r1=155158&r2=155157&pathrev=155158
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-getModifierState.html?r1=155158&r2=155157&pathrev=155158

Add support for KeyboardEvent.getModifierState()

Add support for KeyboardEvent.getModifierState() as per the latest specification:
http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent-getModifierState

Note that only the following modifiers are currently supported ( crbug.com/265458 ):
"Control", "Alt", "Shift", "Meta".

BUG= 263724 

Review URL: https://chromiumcodereview.appspot.com/21030004
------------------------------------------------------------------------

Comment 8 by tkent@chromium.org, Jul 30 2013

Cc: -tkent@chromium.org
Project Member

Comment 9 by bugdroid1@chromium.org, Jul 31 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=155231

------------------------------------------------------------------------
r155231 | ch.dumez@sisa.samsung.com | 2013-07-31T08:47:04.438942Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keydown-numpad-keys-expected.txt?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/KeyboardEvent.cpp?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/script-tests/keydown-numpad-keys.js?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keydown-leftright-keys-expected.txt?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/web/tests/WebInputEventFactoryTestGtk.cpp?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/js-keyboard-event-creation.html?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/KeyboardEvent.h?r1=155231&r2=155230&pathrev=155231
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-location-constants-expected.txt?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/web/WebInputEventConversion.cpp?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/web/tests/WebInputEventConversionTest.cpp?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/js-keyboard-event-creation-expected.txt?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/KeyboardEvent.idl?r1=155231&r2=155230&pathrev=155231
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keydown-leftright-keys.html?r1=155231&r2=155230&pathrev=155231
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-location-constants.html?r1=155231&r2=155230&pathrev=155231

Define DOM_KEY_LOCATION_* constants on KeyboardEvent

Define DOM_KEY_LOCATION_* constants on the KeyboardEvent interface to match
the latest specification:
http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent

Those constants are already supported by IE10 and Firefox 22.

Note that the following constants are not supported internally yet:
DOM_KEY_LOCATION_MOBILE and DOM_KEY_LOCATION_JOYSTICK ( crbug.com/265446 ).

BUG= 263724 

Review URL: https://chromiumcodereview.appspot.com/20986003
------------------------------------------------------------------------
About the "NumLock" key location.

IE and Firefox sets DOM_KEY_LOCATION_STANDARD for NumLock key. However, Chromium sets DOM_KEY_LOCATION_NUMPAD for it. Please change it for the compatibility.
Additionally, keyup event of Shift key, Control key and Alt key is always DOM_KEY_LOCATION_STANDARD.
The location of keypress event on Numpad is always DOM_KEY_LOCATION_STANDARD too.
Thanks for reporting this dtoybox69. I can take a look at those issues after I'm done with the wheel event.
Project Member

Comment 14 by bugdroid1@chromium.org, Aug 26 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=156693

------------------------------------------------------------------------
r156693 | ch.dumez@sisa.samsung.com | 2013-08-26T06:59:38.169469Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keydown-numlock-standard-location.html?r1=156693&r2=156692&pathrev=156693
   M http://src.chromium.org/viewvc/blink/trunk/Source/web/win/WebInputEventFactory.cpp?r1=156693&r2=156692&pathrev=156693
   M http://src.chromium.org/viewvc/blink/trunk/Source/testing/runner/KeyCodeMapping.cpp?r1=156693&r2=156692&pathrev=156693
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keydown-numlock-standard-location-expected.txt?r1=156693&r2=156692&pathrev=156693
   M http://src.chromium.org/viewvc/blink/trunk/Source/testing/runner/EventSender.cpp?r1=156693&r2=156692&pathrev=156693
   M http://src.chromium.org/viewvc/blink/trunk/Source/testing/runner/KeyCodeMapping.h?r1=156693&r2=156692&pathrev=156693

KeyboardEvent.location should be DOM_KEY_LOCATION_STANDARD for Num Lock key

KeyboardEvent.location should be DOM_KEY_LOCATION_STANDARD for Num Lock key.
This behavior is consistent with IE and Firefox. However, Blink returns
DOM_KEY_LOCATION_NUMPAD for it on Windows (the value is correct on Mac and
Linux).

This patch fixes Blink on Windows to be inline with the others.

BUG= 263724 

Review URL: https://chromiumcodereview.appspot.com/22831043
------------------------------------------------------------------------
Blockedon: chromium:281248
Cc: r.kasibh...@samsung.com
Is there anything left that is "safe" to implement?

There were so many comments about things getting possibly renamed / removed in the specification that it is no longer clear to me.
The values for 'key' are significantly different from 'keyIdentifer'. We'll probably need to add 'key' attribute in parallel and then deprecate 'keyIdentifier'. We've pretty much settled on the 'key' values, although we have been adding new values that we need for various platforms.

'char' is no longer part of the spec and can be ignored

'getModifierState' and 'repeat' both seem stable (I'm not aware of any issues with them).

'locale' may be messy because we have concerns the current definition (straight BCP-47 values) may be too general and we'll end up with inter-op issues. We think we need to restrict the values somewhat here but haven't investigated further.

Thanks for the clarification garykac@.

'getModifierState' was already implemented, so this leaves 'key' and 'repeat' attributes as safely implementable for now.
I have a CL up-for-review to implement the 'repeat' attribute:
https://codereview.chromium.org/23444080/
Project Member

Comment 22 by bugdroid1@chromium.org, Oct 4 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=158868

------------------------------------------------------------------------
r158868 | ch.dumez@sisa.samsung.com | 2013-10-04T02:22:03.379012Z

Changed paths:
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-repeat.html?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/events/KeyboardEvent.h?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/events/KeyboardEvent.idl?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/Source/testing/runner/EventSender.cpp?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html?r1=158868&r2=158867&pathrev=158868
   A http://src.chromium.org/viewvc/blink/trunk/LayoutTests/fast/events/keyboardevent-repeat-expected.txt?r1=158868&r2=158867&pathrev=158868
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/events/KeyboardEvent.cpp?r1=158868&r2=158867&pathrev=158868

Implement KeyboardEvent.repeat attribute

Implement KeyboardEvent.repeat attribute as per the DOM level 3 specification:
https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-repeat

This attribute is already implemented in IE10 and is currently being worked on
for Firefox.

BUG= 263724 
TEST=fast/events/constructors/keyboard-event-constructor.html
TEST=fast/events/keyboardevent-repeat.html

Review URL: https://codereview.chromium.org/23444080
------------------------------------------------------------------------
Any updates on this? Are we still waiting for the location bugs?
Hrm, 'repeat' doesn't seem to be set to true when repeating, in Chrome (36 or 38) on Linux at least.
... and windows. Seems to be an Aura issue, not on the Blink side. :(
Blockedon: chromium:394907
Filed  issue 394907  for the repeat bug, will stop spamming here.
Project Member

Comment 27 by bugdroid1@chromium.org, Jul 19 2014

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/350887d8c8f2cd8d6c5d0ab67d66f76cc0a7790c

commit 350887d8c8f2cd8d6c5d0ab67d66f76cc0a7790c
Author: jsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Sat Jul 19 00:34:23 2014

Fix DOM KeyboardEvent 'repeat' state

The 'repeat' state of a DOM KeyboardEvent was always false. The
Aura->blink event modifier mapper was not plumbing it through. Do so!

BUG= 263724 , 394907 
TEST=document.body.onkeydown=function(e){console.log(e.repeat);};

Review URL: https://codereview.chromium.org/402613010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284263 0039d316-1c4b-4281-b951-d872f2087c98


Project Member

Comment 28 by bugdroid1@chromium.org, Jul 19 2014

------------------------------------------------------------------
r284263 | jsbell@chromium.org | 2014-07-19T00:34:23.847473Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/renderer_host/web_input_event_aurax11.cc?r1=284263&r2=284262&pathrev=284263
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/renderer_host/ui_events_helper.cc?r1=284263&r2=284262&pathrev=284263

Fix DOM KeyboardEvent 'repeat' state

The 'repeat' state of a DOM KeyboardEvent was always false. The
Aura->blink event modifier mapper was not plumbing it through. Do so!

BUG= 263724 , 394907 
TEST=document.body.onkeydown=function(e){console.log(e.repeat);};

Review URL: https://codereview.chromium.org/402613010
-----------------------------------------------------------------
Project Member

Comment 29 by bugdroid1@chromium.org, Jul 29 2014

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e74f0e97ed9e5e6877c223fc328c4473f8d6eb60

commit e74f0e97ed9e5e6877c223fc328c4473f8d6eb60
Author: jsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Tue Jul 29 04:23:24 2014

Fix 'repeat' state of a DOM KeyboardEvent on Windows

The WM_KEYDOWN-to-WebKeyboardEvent mapping was incorrect, probably
because MSDN is not helpful. Bits 0-15 of lParam are the number of
coalesced events that this message represents (which is 1 unless
you're not pumping messages fast enough). Bit 30 of lParam represents
the previous key state - i.e. if it was already down; if so, this
is a repeat.

This manifests in the 'repeat' state of a DOM KeyboardEvent.

BUG= 263724 , 394907 
TEST=window.onkeydown=function(e){console.log(e.repeat);};

Review URL: https://codereview.chromium.org/419283003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286090 0039d316-1c4b-4281-b951-d872f2087c98


Project Member

Comment 30 by bugdroid1@chromium.org, Jul 29 2014

------------------------------------------------------------------
r286090 | jsbell@chromium.org | 2014-07-29T04:23:24.976923Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/renderer_host/input/web_input_event_builders_win.cc?r1=286090&r2=286089&pathrev=286090

Fix 'repeat' state of a DOM KeyboardEvent on Windows

The WM_KEYDOWN-to-WebKeyboardEvent mapping was incorrect, probably
because MSDN is not helpful. Bits 0-15 of lParam are the number of
coalesced events that this message represents (which is 1 unless
you're not pumping messages fast enough). Bit 30 of lParam represents
the previous key state - i.e. if it was already down; if so, this
is a repeat.

This manifests in the 'repeat' state of a DOM KeyboardEvent.

BUG= 263724 , 394907 
TEST=window.onkeydown=function(e){console.log(e.repeat);};

Review URL: https://codereview.chromium.org/419283003
-----------------------------------------------------------------

Comment 31 by ojan@chromium.org, Oct 16 2014

Cc: -ojan@chromium.org

Comment 32 by w...@chromium.org, Dec 2 2014

Cc: kpschoedel@chromium.org

Comment 33 by w...@chromium.org, Dec 2 2014

Blockedon: chromium:227231

Comment 34 by w...@chromium.org, Dec 2 2014

Blocking: -chromium:227231
Labels: -Type-Bug -Cr-Blink-DOM Type-Feature Hotlist-Input-Dev Cr-Blink-Input
ch.dumez, you're not still actively working on this, are you?
Cc: -garykac@chromium.org habib.vi...@samsung.com
Owner: garykac@chromium.org
ch.dumez no longer works at samsung.  Assigning to Gary (KeyboardEvent spec editor) for tracking.

Comment 37 by stan...@gmail.com, Jun 26 2015

Any news here? This is a problem for lot of users.

Comment 38 by w...@chromium.org, Jul 25 2015

Owner: rbyers@chromium.org
Assigning to Rick to track for now.
Cc: dtapu...@chromium.org
I think the most active work is in  issue 227231  (code and key), we're still trying to get that landed.
Cc: -dtapu...@chromium.org rbyers@chromium.org
Owner: dtapu...@chromium.org
Blockedon: chromium:527111
Project Member

Comment 42 by sheriffbot@chromium.org, Jul 5 2016

Labels: Hotlist-OpenBugWithCL
A change has landed for this issue, but it's been open for over 6 months. Please review and close it if applicable. If this issue should remain open, remove the "Hotlist-OpenBugWithCL" label. If no action is taken, it will be archived in 30 days.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-OpenBugWithCL
isComposing support still needs to be done
Status: Fixed (was: Assigned)

Sign in to add a comment