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

Issue 677827 link

Starred by 6 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Keydown on an input field after autocomplete doesn't work the first time

Reported by p...@paultondeur.com, Jan 2 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce the problem:
I created a JSFiddle to demonstrate the issue: http://jsfiddle.net/rzngeLhj/

1. Trigger autofill suggestions on an input field
2. Select an autofill option using your keyboard.
3. Hit enter
4. Type 2 characters

What is the expected behavior?
Both characters to show up after the autocompleted text in the input field.

What went wrong?
Just one character appears to be appended to the input.

Did this work before? N/A 

Chrome version:  57.0.2969.0  Channel: canary
OS Version: OS X 10.12.2
Flash Version: Shockwave Flash 24.0 r0

I tested with Canary 56 and 57 which did not work as expected. I also tested with Chrome 55 (non canary), which seemed to work as expected. Not sure if this is a canary only bug, or something that was introduced in Canary 56.
 
Cc: kkaluri@chromium.org
Labels: -Type-Bug hasbisect-per-revision M-57 OS-Linux Type-Bug-Regression
Owner: foolip@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce this issue on Ubuntu 14.04  with chrome version 55.0.2883.87 and Mac 10.12.2 on chrome beta #56.0.2924.28, dev #57.0.2950.4 and also in current canary version #57.0.2970.0
Issue is broken in M56
Note:
-----
Unable to reproduce on stable version and in Windows OS platform

Bisect Info:
===========
Good build : 56.0.2914.0,  Revision Range -430837
Bad build  : 56.0.2915.0,  Revision Range -431137

After executing the per-revision bisect , i got the following CL's between good and bad build versions
===========================================
https://chromium.googlesource.com/chromium/src/+log/3fbe4d26c6c6920babf2a83b3741b4e94ce689ba..35d322e24f91a372ecdc0b152891e0635187a07e

The suspecting Change Log is :
-----------
https://chromium.googlesource.com/chromium/src/+/35d322e24f91a372ecdc0b152891e0635187a07e

From the above CL suspecting the below change
---------------------------
Review-Url: https://codereview.chromium.org/2482853002

foolip@- Could you please look into this issue, if it's related to your change?  if not could you please help us to reassign this issue to the right owner.

Comment 2 by ajha@chromium.org, Jan 17 2017

Cc: dtapu...@chromium.org
Labels: -Pri-2 -M-57 M-56 Pri-1
Gentle ping to get an update on this.

Comment 3 by foolip@chromium.org, Jan 17 2017

I haven't yet had time to investigate this issue, but it's on my list of things to do. Simply reverting https://codereview.chromium.org/2482853002 is unfortunately not a good option.

Comment 4 by shima...@gmail.com, Jan 17 2017

The patch https://codereview.chromium.org/2482853002
aims to address the  issue 654140 , right?

If the patch can be modified to work only when the browser window is fullscreen, then at least my problems described in  Issue 668969  will be solved not perfectly but mostly. If a perfect fix is diffcult, even such a temporary fix will be appreciated. 

Comment 5 by foolip@chromium.org, Jan 17 2017

Yes, it was to address fullscreen trapping as in  issue 654140 .  Issue 668969  had the M-57 label but actually this affects M-56, so a fix is somewhat urgent. I'll do my best to have one this week.

Comment 6 by foolip@chromium.org, Jan 17 2017

Labels: ReleaseBlock-Stable
Thanks for the updates. 

We are close to Stable Release, please make sure to land the fix and get it merged into the release branch ASAP. Thank you!

Comment 8 by foolip@chromium.org, Jan 18 2017

Yeah, sorry about that, because  issue 668969  had the M-57 label I mistakenly thought that the relevant change landed after the M57 branch point and that I had more time to handle this. Will look into it today.

Comment 9 by foolip@chromium.org, Jan 18 2017

I've added some logging http://jsfiddle.net/rzngeLhj/2/ to get clues.

Following the instructions and pressing keys a, down, enter, b, c, these are the events delivered before my change:

keydown: KeyA
keypress: KeyA
keyup: KeyA
keyup: ArrowDown
keyup: Enter
keydown: KeyB
keypress: KeyB
keyup: KeyB
keydown: KeyC
keypress: KeyC
keyup: KeyC

And after:

keydown: KeyA
keypress: KeyA
keyup: KeyA
keydown: KeyB
keyup: KeyB
keydown: KeyC
keypress: KeyC
keyup: KeyC

In other words, previously bare keyup events for ArrowDown and Enter were sent, and all three events for b and c. Now, no events are sent for ArrowDown and Enter, which arguably makes more sense. But the keypress event for KeyB has also gone missing, which does not make sense however one looks at it.
It looks as though the problem here is an additional layer of keypress event suppression in WebViewImpl. With the sequence of events now reaching WebViewImpl now slightly different, the RawKeyDown event for the first event after enter in WebViewImpl::handleKeyEvent() gets a WebInputEventResult::HandledSystem result, which causes m_suppressNextKeypressEvent to be set to true.

That's all for today, will have to step in debugger to see what different state is causing this. (Before the change, that event would not be considered handled and thus the following event is not suppressed.)
Cc: sadrul@chromium.org mgiuca@chromium.org
Looping in all reviewers of https://codereview.chromium.org/2482853002

The cause of this is now clear. In the repro steps, one presses the ArrowDown key to select one of the datalist options. For they key, RenderWidgetHostViewAura::ForwardKeyboardEvent created and sent a MoveDown command right before the call to RenderWidgetHostImpl::ForwardKeyboardEvent. There, if the key sequence is suppressed entirely, that command will be taken to apply to whatever keypress follows. In the repro steps, that was KeyB, and the reason the keypress event goes missing is that HTMLInputElement::defaultEventHandler() ends up in RenderFrameImpl::handleCurrentKeyboardEvent() where the MoveDown command is executed and the key event is considered handled, which suppresses the keypress event.
CL is going through a CQ dry run: https://codereview.chromium.org/2644843004
Labels: Needs-triage-Mobile
Project Member

Comment 14 by bugdroid1@chromium.org, Jan 24 2017

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

commit b7b0799fa40dd39cc93e826e6bacfea41231d989
Author: foolip <foolip@chromium.org>
Date: Tue Jan 24 09:11:16 2017

Send keyboard-derived commands only if the key events are sent

There was a regression in https://codereview.chromium.org/2482853002

Previously, when a keydown was handled on the browser side, the keypress
was suppressed but the keyup was not. Now, all three events are
suppressed. However, the fix did not take into consideration the
InputMsg_SetEditCommandsForNextKeyEvent messages sent right before the
call to RenderWidgetHostImpl::ForwardKeyboardEvent at two call sites.
Because the keyup event was also suppressed, those commands would
instead be associated with a following keydown.

See https://bugs.chromium.org/p/chromium/issues/detail?id=677827#c11 for
how that could end up dropping the keypress event of what followed.

The fix is to introduce a ForwardKeyboardEventWithCommands which sends
the commands only if they key itself is sent.

BUG= 677827 

Review-Url: https://codereview.chromium.org/2644843004
Cr-Commit-Position: refs/heads/master@{#445687}

[modify] https://crrev.com/b7b0799fa40dd39cc93e826e6bacfea41231d989/content/browser/renderer_host/render_widget_host_impl.cc
[modify] https://crrev.com/b7b0799fa40dd39cc93e826e6bacfea41231d989/content/browser/renderer_host/render_widget_host_impl.h
[modify] https://crrev.com/b7b0799fa40dd39cc93e826e6bacfea41231d989/content/browser/renderer_host/render_widget_host_unittest.cc
[modify] https://crrev.com/b7b0799fa40dd39cc93e826e6bacfea41231d989/content/browser/renderer_host/render_widget_host_view_aura.cc
[modify] https://crrev.com/b7b0799fa40dd39cc93e826e6bacfea41231d989/content/browser/renderer_host/render_widget_host_view_mac.mm

Labels: -M-56 -ReleaseBlock-Stable ReleaseBlock-Beta M-57 Merge-Request-57
It is too late to merge this to M56 now, which is my fault as described in #8. Instead targeting 57, tweaking labels to reflect this.
Project Member

Comment 16 by sheriffbot@chromium.org, Jan 25 2017

Labels: -Merge-Request-57 Hotlist-Merge-Approved Merge-Approved-57
Your change meets the bar and is auto-approved for M57. Please go ahead and merge the CL to branch 2987 manually. Please contact milestone owner if you have questions.
Owners: amineer@(clank), cmasso@(bling), ketakid@(cros), govind@(desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 17 by bugdroid1@chromium.org, Jan 25 2017

Labels: -merge-approved-57 merge-merged-2987
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/69e39c484ec2f1f3b7320f07f43fd0724b6cb382

commit 69e39c484ec2f1f3b7320f07f43fd0724b6cb382
Author: Philip Jägenstedt <foolip@chromium.org>
Date: Wed Jan 25 09:53:03 2017

Send keyboard-derived commands only if the key events are sent

There was a regression in https://codereview.chromium.org/2482853002

Previously, when a keydown was handled on the browser side, the keypress
was suppressed but the keyup was not. Now, all three events are
suppressed. However, the fix did not take into consideration the
InputMsg_SetEditCommandsForNextKeyEvent messages sent right before the
call to RenderWidgetHostImpl::ForwardKeyboardEvent at two call sites.
Because the keyup event was also suppressed, those commands would
instead be associated with a following keydown.

See https://bugs.chromium.org/p/chromium/issues/detail?id=677827#c11 for
how that could end up dropping the keypress event of what followed.

The fix is to introduce a ForwardKeyboardEventWithCommands which sends
the commands only if they key itself is sent.

BUG= 677827 

Review-Url: https://codereview.chromium.org/2644843004
Cr-Commit-Position: refs/heads/master@{#445687}
(cherry picked from commit b7b0799fa40dd39cc93e826e6bacfea41231d989)

Review-Url: https://codereview.chromium.org/2650913006 .
Cr-Commit-Position: refs/branch-heads/2987@{#84}
Cr-Branched-From: ad51088c0e8776e8dcd963dbe752c4035ba6dab6-refs/heads/master@{#444943}

[modify] https://crrev.com/69e39c484ec2f1f3b7320f07f43fd0724b6cb382/content/browser/renderer_host/render_widget_host_impl.cc
[modify] https://crrev.com/69e39c484ec2f1f3b7320f07f43fd0724b6cb382/content/browser/renderer_host/render_widget_host_impl.h
[modify] https://crrev.com/69e39c484ec2f1f3b7320f07f43fd0724b6cb382/content/browser/renderer_host/render_widget_host_unittest.cc
[modify] https://crrev.com/69e39c484ec2f1f3b7320f07f43fd0724b6cb382/content/browser/renderer_host/render_widget_host_view_aura.cc
[modify] https://crrev.com/69e39c484ec2f1f3b7320f07f43fd0724b6cb382/content/browser/renderer_host/render_widget_host_view_mac.mm

Status: Fixed (was: Assigned)

Comment 19 by ajha@chromium.org, Jan 25 2017

Just to update regarding the added 'Needs-triage-Mobile' label on the reported version: 57.0.2969.0.

Issue is not applicable on Samsung Galaxy S5 Handset, Android Version: 5.0.0; SM-G900H Build/LRX21T and Galaxy Tab S2, Android Version: 6.0.1; SM-T815Y Build/MMB29K. 

Steps followed:
================
1. Paired a Bluetooth keyboard to the Handset and Tablet.
2. Opened the jsfiddle: http://jsfiddle.net/rzngeLhj/

Unable to select jsfiddle option using arrow down key from the paired Bluetooth keyboard on the above jsfiddle.
Cc: ranjitkan@chromium.org foolip@chromium.org
 Issue 691254  has been merged into this issue.

Sign in to add a comment