focus() on elements does not change computed style when using devtools (remote debugging)
Reported by
gammab...@gmail.com,
Feb 3 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Steps to reproduce the problem: 1. Open the supplied html file in a chromium browser. 2. Refresh the page and wait 5 seconds 3. Notice that the color of the link changes from RED to GREEN, this should also be reported as success in the textarea. 4. Right click on the page, choose "Inspect" 5. Select the "Developer Tools" tab or window that opens. 6. Reload the page by click "F5" in the developer tools window. 7. Wait 5 seconds once more 8. Notice that the color of the link stays RED after calling focus. 9. Notice the reported colors always shows that the color stays RED from the scripts point of view. What is the expected behavior? The computed style of the link should change so that the link goes from RED to GREEN after the 5 seconds, regardless of where the request to load the page comes from. What went wrong? Quite possibly the Developer Tools steals focus from the page and somehow stops the focus from working properly. Did this work before? No Chrome version: 56.0.2924.87 Channel: n/a OS Version: 10.0 Flash Version: Shockwave Flash 24.0 r0 What I have described is a simplified test to show the deeper problem. The bigger problem is that a chromium instance running on a remote machine with a debugging port open behaves in the same problematic manor when having another machine connecting through the port and issuing page navigations. One of the programs I'm writing uses this protocol and uses Page.navigate from https://chromedevtools.github.io/debugger-protocol-viewer/tot/Page/ experiencing exactly this problem.
,
Feb 6 2017
Able to reproduce this issue on Win-10 and Ubuntu 14.04 using chrome reported version #56.0.2924.87 and latest canary #58.0.3003.0. Unable to reproduce on Mac. This is a non-regression issue as it is observed from M30 old builds. Hence, marking it as untriaged to get more inputs from dev team.
,
Dec 5 2017
Document might or might not have "focus". This is verifiable with "document.hasFocus()" api. When you open devtools and focus them, the page's document doesn't have any focus. The "link.focus()" call that your script does changes document's activeElement. The active element will be in focus if the document is focused. In your case, since the focus is on devtools, the link is the document's activeElement but it's not active. For this reason, the css pseudo class ":focus" is not applied, and thus the behavior. Hope this helps. |
|||
►
Sign in to add a comment |
|||
Comment 1 by eostroukhov@chromium.org
, Feb 3 2017