Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Issue 112553002: Implement new focusing steps for modal <dialog>. (Closed)

Created:
7 years ago by falken
Modified:
7 years ago
Reviewers:
esprehn, dmazzoni
CC:
blink-reviews, dglazkov+blink, adamk+blink_chromium.org, eseidel, dominicc (has gone to gerrit)
Visibility:
Public.

Description

Implement 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -8 lines) Patch
A LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html View 1 2 1 chunk +63 lines, -0 lines 0 comments Download
A LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps-expected.txt View 1 2 1 chunk +21 lines, -0 lines 0 comments Download
M Source/core/html/HTMLDialogElement.cpp View 1 2 3 chunks +31 lines, -8 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
falken
Dominic: could you please review? This obsoletes the focus event forcing I was working on ...
7 years ago (2013-12-12 08:04:02 UTC) #1
falken
+dominicc
7 years ago (2013-12-12 08:31:10 UTC) #2
dmazzoni
New description sounds good, but I don't see the new code - did the upload ...
7 years ago (2013-12-12 16:04:49 UTC) #3
dmazzoni
Oh, nevermind, I was looking at the wrong change. On Thu, Dec 12, 2013 at ...
7 years ago (2013-12-12 16:07:02 UTC) #4
dmazzoni
lgtm Great! It sounds like we may still need an accessibility fix if the dialog ...
7 years ago (2013-12-12 16:12:54 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/falken@chromium.org/112553002/50001
7 years ago (2013-12-12 16:13:00 UTC) #6
commit-bot: I haz the power
Change committed as 163796
7 years ago (2013-12-12 17:08:56 UTC) #7
falken
7 years ago (2013-12-13 01:45:11 UTC) #8
Message was sent while issue was closed.
On 2013/12/12 16:12:54, Dominic Mazzoni wrote:
> lgtm
> 
> Great!
> 
> It sounds like we may still need an accessibility fix if the dialog has no
> focusable children and isn't itslef focusable?

This case actually turns out pretty good for NVDA-- it reads the document title
followed by "dialog". I think what fixed it is now we send the focus event after
throwing away the cache.

I'd still like to get rid of reading the document title each time dialog is
opened/closed, but we're improving.

Powered by Google App Engine
This is Rietveld 408576698