activeElement should never be in an inert context / below a top-level element (e.g. <dialog>) |
||||||||||||||||||||||
Issue descriptionChrome Version: (copy from chrome://version) 57.0.2937.0 (Developer Build) (64-bit) OS: (e.g. Win7, OSX 10.9.5, etc...) Linux, Ubuntu What steps will reproduce the problem? (1) Visit chrome://md-settings/clearBrowserData (shows a <dialog>) (or https://jsfiddle.net/ozr8acaq/ + click "focus me!") (2) Click on the "scrim" (gray background) (3) console.log(document.activeElement) What is the expected result? the showing <dialog> or something in it What happens instead? <body> Please use labels and text to provide additional information. I'm fairly sure that Document::activeElement()[1] or TreeScope::adjustedFocusElement()[2] needs to be massaged to look for top-level elements. If a <dialog> is shown without anything focusable in it (i.e. https://jsfiddle.net/ozr8acaq/1/), I assume the <dialog> should to be the activeElement (or something), and should probably get a 'focus' event dispatched or something. [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/Document.cpp?q=document::activeelement&sq=package:chromium&dr=CSs&l=6293 [2] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/TreeScope.cpp?sq=package:chromium&dr=CSs&rcl=1480537046&l=396 For graphics-related bugs, please copy/paste the contents of the about:gpu page at the end of this report. n/a
,
Dec 1 2016
with me*
,
Dec 1 2016
btw, falken@ told me over chat that `document.body` might be a special case here (and there are multiple tests that imply the same)
,
Dec 2 2016
Yes document.body should be the only exception. From what I remember and based on the CL description at https://codereview.chromium.org/112553002, if a modal dialog is open but nothing is focusable, document.body gets focus as a last resort. I vaguely remember Blink has some assumptions over the codebase that when nothing is focusable document.body will get it, which I think is what I'm referring to here: "a) it would make document.body inert, which violates assumptions of document.body getting default focus when nothing else can have focus, and" Indeed the CL doesn't explicitly give focus to body, but instead called document().setFocusedElement(0); which effectively gives document.body focus. Anyway that CL does recognize that the actual spec and desirable behavior would be for document.body to not get focus (I'm not sure what document.activeElement would be then... null? or maybe <dialog> should get last resort focus even if it's not focusable) but mentions the problems were a) and b) (accessibility tree gets confused). I'm not sure if a) and b) are still problems today but that's why document.body gets focus.
,
Dec 2 2016
Digging into history more, there was a huge spec discusssion about this. Some people were advocating for <dialog> to be focusable but Hixie was unconvinced: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23366
,
Dec 12 2016
I'm going to bump the priority down on this since it's not new. Tagging this with accessibility (not sure if that's the right label)--a11y people, do you have opinions here? I notice S. Faulkner on the issue linked in Comment 5 is talking about the effect this has on AT. kochi, could you investigate what the spec requires and what other browsers do? We need to decide whether we should change the spec behavior or fix Blink.
,
Dec 13 2016
No other browser implements <dialog> yet, so we should do whatever makes sense and provide spec feedback to change the spec to make sense too.
,
Dec 14 2016
Mozilla seems to be implementing so now's a good time for feedback: https://bugzilla.mozilla.org/show_bug.cgi?id=1322938
,
Mar 27 2017
,
Apr 21 2017
,
Apr 21 2017
,
Jul 27 2017
,
Aug 9 2017
Seems like we need to implement the focus fixup rules to fix this: https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one
,
Aug 9 2017
Alice could you take over this issue?
,
Aug 11 2017
,
Aug 11 2017
,
Aug 14 2017
I don't have time to work on this in foreseeable future, changing the status to "Available".
,
Sep 29 2017
,
Sep 29 2017
,
Oct 17 2017
,
Dec 14 2017
,
Dec 14 2017
Update from dsexton, this is concerning spec compliance but it is also relevant to how dialogs receive focus. Includes Windows.
,
Dec 14 2017
@foolip, would you mind taking a fresh look at this? I'm curious about whether you can reproduce the bug with fullscreen instead of dialog, and I imagine the fix ought to be similar.
,
Dec 15 2017
,
Feb 1 2018
dmazzoni@, it's been a month and a half, sorry about that. This will affect fullscreen as well, but if the fix for this is implementing https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one then I believe the Blink>HTML component is the right one. I may run across this with fullscreen, but for now the honest status of this is that I'm not going to look at it until I run into it with fullscreen, especially given that it's a P3. I'll add myself to CC though and am adding the Blink>Fullscreen component.
,
Sep 18
,
Sep 18
,
Sep 18
,
Dec 7
|
||||||||||||||||||||||
►
Sign in to add a comment |
||||||||||||||||||||||
Comment 1 by dbeam@chromium.org
, Dec 1 2016