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

Issue 594552 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Mar 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocking:
issue 227231



Sign in to add a comment

NumPad produces wrong DomKey when combining with NumLock+Shift

Project Member Reported by chongz@chromium.org, Mar 14 2016

Issue description

Version: 51.0.2677.0 canary (64-bit)
OS: Windows 10

What steps will reproduce the problem?
(1)Make sure "experimental Web Platform features" is enabled in chrome://flags
(2)Navigate to http://nonan.jp/keyevent/input.html
(3)Try all combinations of Shift and CapsLock with NumPad4

What is the expected output? 
The produced DomKey should be:
  NumPad4 => "ArrowLeft"
  Shift+NumPad4 => "ArrowLeft"
  CapsLock+NumPad4 => "4"
  Shift+CapsLock+NumPad4 => "ArrowLeft"

What do you see instead?
They all produce DomKey "4".


 

Comment 1 by chongz@chromium.org, Mar 14 2016

Correction: in the descripstion |CapsLock| should actually be |NumLock|.

Comment 2 by chongz@chromium.org, Mar 21 2016

Related Windows API issue fake-shift-release behaviour:
  With NumLock on,
	1. press Shift
	2. press NumPad4
	3. release NumPad4
	4. release Shift
will produce:
-----
EventType	DomCode		Shift	NumLock
-----
keydown 	ShiftLeft	true	true
keyup		ShiftLeft	false	true
keydown		Numpad4		false	true  <- Shift is false?!
keyup		NumPad4		false	true
keydown		ShiftLeft	true	true
keyup		ShiftLeft	false	true
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 22 2016

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

commit 866b9e1c3542ed922285cf06b7d60f89758b20b5
Author: chongz <chongz@chromium.org>
Date: Tue Mar 22 15:33:12 2016

[Windows] Produce correct DomKey for NumPad when combined with Shift/NumLock

The expected behavior for Shift, NumLock and NumPad should be (use NumPad4 as an example):
  NumPad4 => "ArrowLeft"
  Shift+NumPad4 => "ArrowLeft"
  NumLock+NumPad4 => "4"
  Shift+NumLock+NumPad4 => "ArrowLeft"

However there is an implementation problem due to Windows' fake-shift-release behaviour, which means we cannot use DomCode+Flags to uniquely determine DomKey.
(Cannot distinguish NumLock+NumPad4 and Shift+NumLock+NumPad4)

The alternative approach is to use KeyboardCode instead DomCode because Shift modifier is not reliable
when NumLock is on.

/*
Example for Windows' fake-shift-release behaviour:
  With NumLock on,
	1. press Shift
	2. press NumPad4
	3. release NumPad4
	4. release Shift
will produce:
-----
EventType	DomCode		Shift	NumLock
-----
keydown 	ShiftLeft	true	true
keyup		ShiftLeft	false	true
keydown		Numpad4		false	true  <- Shift is false?!
keyup		NumPad4		false	true
keydown		ShiftLeft	true	true
keyup		ShiftLeft	false	true
*/

BUG= 594552 

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

Cr-Commit-Position: refs/heads/master@{#382574}

[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/BUILD.gn
[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/event.cc
[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/events.gyp
[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/keycodes/platform_key_map_win.cc
[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/keycodes/platform_key_map_win.h
[modify] https://crrev.com/866b9e1c3542ed922285cf06b7d60f89758b20b5/ui/events/keycodes/platform_key_map_win_unittest.cc

Comment 4 by chongz@chromium.org, Mar 22 2016

Labels: M-51
Status: Fixed (was: Started)

Sign in to add a comment