Issue metadata
Sign in to add a comment
|
Event listener added to window no longer working in Chrome 61+
Reported by
jason.so...@gmail.com,
Oct 31 2017
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Platform: 9765.85.0 (Official Build) stable-channel clapper
Steps to reproduce the problem:
1. In a Chrome Packaged App with a background js running, create a new window. (chrome.app.window.create) and have it load an HTML file packaged with the app. This HTML file includes a javascript file also packaged with the app.
2. This javascript file should register an event listener to the window :
window.addEventListener("keydown", keyHandler);
This is done at root of the javascript, not in a function call and before the keyHandler function is defined
3. Give focus to the created window and press a keyboard key.
What is the expected behavior?
The registered function will be called with the correct key event as input
What went wrong?
The registered function is no longer being called as of Chrome 61. This same code has been working in our app since at least 2014, and we were able to retest on Chrome 58 and 59 today and it still worked there. We know it doesn't work on Chrome 61 and later, but are not sure about Chrome 60.
Did this work before? Yes 59
Chrome version: 61.0.3163.123 Channel: stable
OS Version: 61.0.3163.123 (Official Build) (64-bit)
Flash Version: Shockwave Flash 27.0 r0
The HTML page contains a webview which is still receiving key events
,
Nov 1 2017
https://chrome.google.com/webstore/detail/testnav/mdmkkicfmmkgmpkmkdikhlbggogpicma?hl=en. After you launch the app, press the "<-" key. This key was blocked on prior versions of cros
,
Nov 1 2017
,
Nov 1 2017
+dtapuska to see the example in #2
,
Nov 3 2017
Any updates on this yet?
,
Nov 6 2017
any updates on this?
,
Nov 7 2017
,
Nov 13 2017
I tried this on a Chrome Pixelbook 61.0.3163.110 and I don't see the issue. I loaded the app in comment #1 which opened a new window. And then I task switched to chrome://inspect, chose the App opened the console for it with monitorEvents(window, "keydown"); then task switched back to the app and it records all the keys that I press in the console.
,
Nov 13 2017
This does not dispatch events for back, refresh, fullscreen or minimize screen brightness but does for every key on my chromebook. What keys are you indicating it isn't being reported for?
,
Nov 13 2017
For us the key handler function wasn't being called at all on any keypress. It seems like this behavior may have been very specific to certain versions of Chrome (61.0.3163.123) so I will have our internal testers try this again and see if they can narrow it down. If it all seems to be working on the latest stable versions then we may not have an issue.
,
Nov 13 2017
I've tried on Chrome 62.0.3202.82 as well. Do you have any other extensions installed?
,
Nov 14 2017
The NextAction date has arrived: 2017-11-14
,
Nov 15 2017
Our testers tried this again in61.0.3163.123 and 62.0.3202.82 along with the 63 beta channel version, and are now reporting the key handlers are working fine. We had multiple people recreate this internally, so maybe there was something with a very particular Chrome version that we ran into. Since it appears to be working now, this can be closed. Thanks for your help!
,
Nov 15 2017
,
Dec 4 2017
I had this same issue today, and here are the specs for my Chromebook: UserAgent: Mozilla/5.0 (X11; CrOS armv7l 10032.59.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.70 Safari/537.36 Platform: 10032.59.0 (Official Build) beta-channel veyron_minnie Chrome version: 63.0.3239.70 Channel: beta OS Version: 10032.59.0
,
Dec 15 2017
yup, this issue is still happening. Can we guys try it again and get it fixed?
,
Jan 9 2018
dtapuska@ can you take another look at this given that we've gotten some reports this is now recurring on M63? There is also info on crbug.com/799471 , which I will dupe into this one.
,
Jan 9 2018
Issue 799471 has been merged into this issue.
,
Jan 11 2018
I still can't make this happen. Is it possible to provide a screen recording of the problem. And if so can you open devtools (via going to chrome://inspect/#apps and click the associated tab) and then in the console monitorEvents(window, "keydown");
,
Jan 17 2018
I see this still today. My Chromebook is on Chrome 64.0.3282.87. We have the keydown listener on the window, and a webview loaded inside. The keydown event handler on the window is not triggered by a keydown in the webview. I took a screen recording of the app and a secondary window with the console. I added a keydown listener to the window and to the webview just to log keydown events, and you can see that the key is only logged in the webview, not the window. First I pressed TAB for a test, then the Chromebook back button.
,
Jan 17 2018
Updated screen recording with monitorEvents(window, "keydown") as requested.
,
Jan 17 2018
Oh see I see the misunderstanding now... You are expecting the keydown inside the chrome-extension:// window. Bisected to change: https://chromium.googlesource.com/chromium/src/+/3131414035a033d1fb624913474dbdac04158198 Expect that this is working as intended because the origin of the two documents is different. Over to lfg@ to comment.
,
Jan 17 2018
Thanks for triaging, Dave. This is working as intended. A bit of context: before the refactor on GuestViews to use the RenderFrame architecture, we used a plugin to embed the webview, and the plugin relied on event forwarding from one process to another. A side effect of this is that the event listeners would fire on the parent, as well as the child. We've always considered this a bug. Now we are only firing event listeners on the focused frame, which means that the parent will not receive the input events. If you need the input events in the parent, the supported way achieve this is to use the script injection APIs to inject code that forwards the events via the postMessage API.
,
Jan 25 2018
The NextAction date has arrived: 2018-01-25
,
Jan 25 2018
I don't understand this. If the webview doesn't get the key input events, how can it post them back to the parent? Do injected scripts get some extra system level view?
,
Jan 25 2018
If the webview is focused, then it will get the key inputs. Otherwise they would presumably being going to the parent anyways, and can be handled there in the usual way.
,
Jan 25 2018
,
Jan 25 2018
The key events are going to the webview. What this bug is about is that with the new architecture you aren't seeing the keypress events in the page that embeds the webview (the parent). lfg & wjmaclean are advocating that you add script to your webview page that then posts the key events back to the embedding page. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by dtapu...@chromium.org
, Oct 31 2017NextAction: 2017-11-14