Chromium Code Reviews
DescriptionImplement new focusing steps for modal <dialog>.
When a modal <dialog> is opened, then
1) The first autofocusable element in the dialog gets focus, or else
2) The first focusable element in the dialog gets focus, or else
3) The dialog itself gets focus, if it's focusable, or else
4) Focus is cleared (effectively, document.body gets focus)
I chose to do (4) since the the previous implementation
relied on CheckFocusedElementTask to clear focus, which
isn't great because "dialog.showModal(); document.activeElement"
was a race condition. One problem with (4) is it will
remove focus from a non-inert ancestor, but the spec also recently
changed to make ancestors inert so that's the direction to take.
We can't make that change immediately though since:
a) it would make document.body inert, which violates
assumptions of document.body getting default focus when
nothing else can have focus, and
b) it would prune the modal <dialog> out of the accessibility
tree
As per the recent spec change:
http://html5.org/r/8338
BUG=298078, 324401
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=163796
Patch Set 1 #Patch Set 2 : layout test #Patch Set 3 : make ancestors inert #Patch Set 4 : drop inert ancestors change #
Messages
Total messages: 8 (0 generated)
|
|||||||||||||||||||||||||||||||||||||