diff --git a/source b/source index 371381f52dd..e04a72deec1 100644 --- a/source +++ b/source @@ -74520,9 +74520,15 @@ END:VCARD
Each Document
has an autofocus candidates list,
+ initially empty.
Each Document
has an autofocus processed flag boolean, initially
+ false.
When an element with the autofocus
attribute specified
- is inserted into a document, queue a
- task on the user interaction task source to run the following steps:
If the user has indicated (for example, by starting to type in a form control) that they @@ -74536,24 +74542,111 @@ END:VCARD
If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.
Let topDocument be the active document of target's + browsing context's + top-level browsing context.
If target's origin is not the same as the origin of the node document of the currently - focused element in target's top-level browsing context, then + origin">same as the origin of topDocument, then return.
If topDocument's autofocus processed flag is false, then + remove the element from topDocument's + autofocus candidates, and append the element to + topDocument's autofocus candidates.
We do not check if an element is a focusable area before storing it + in the autofocus candidates list, because even if it is not a focusable area when it + is inserted, it could become one by the time flush autofocus candidates sees it.
+ +To flush autofocus candidates for a document topDocument, run these + steps:
+ +If topDocument's autofocus processed flag is true, then return.
If target's origin is not the same as the origin of the active document of - target's top-level browsing context, then return.
Let candidates be topDocument's autofocus + candidates.
If candidates is empty, then + return.
If topDocument's focused area + is not topDocument itself, or topDocument's + URL's + fragment is not empty, then:
+ +Empty candidates.
If the user agent has already reached the last step of this list of steps in response to
- an element being inserted into a
- Document
whose top-level browsing context's active
- document is the same as target's top-level browsing
- context's active document, then return.
Set topDocument's autofocus processed flag to true.
Return.
While candidates is not empty:
-Run the focusing steps for the element. User agents may also change the - scrolling position of the document, or perform some other action that brings the element to the - user's attention.
Let element be candidates[0].
Let doc be element's node document.
If doc is not fully active, then + remove element from candidates, and + continue.
If doc's browsing context's + top-level browsing context is not same as topDocument's + browsing context, then + remove element from candidates, and + continue.
If doc's script-blocking style sheet counter is greater than 0, + then return.
+ +In this case, element is the currently-best candidate, but + doc is not ready for autofocusing. We'll try again next time flush + autofocus candidates is called.
+Remove element from + candidates.
Let inclusiveAncestorDocuments be a list consisting of + doc, plus the active documents of each of + doc's browsing context's + ancestor browsing contexts.
If URL's
+ fragment of any Document
in
+ inclusiveAncestorDocuments is not empty, then continue.
If element is a focusable area, then:
+ +Empty candidates.
Set topDocument's autofocus processed flag to true.
Run the focusing steps for element.
Autofocus candidates can contain elements which are not focusable
+ areas. This can happen either because a non-focusable area element with an
+ autofocus
attribute was inserted into a document and it never became focusable, or because the
+ element was focusable but its status changed while it was stored in autofocus
+ candidates.
This handles the automatic focusing during document load. The
methods of
dialog
elements also processes the autofocus
attribute.
Focusing the control does not imply that the user agent has to focus the browser +
Focusing the element does not imply that the user agent has to focus the browser window if it has lost focus.
The autofocus
IDL attribute must
@@ -91215,6 +91308,14 @@ dictionary PromiseRejectionEventInit : EventInit {
For each fully active Document
in docs, update the
rendering or user interface of that Document
and its browsing context to reflect the current state.
For each fully active Document
in docs, flush
+ autofocus candidates for that Document
if its
+ browsing context is a
+ top-level browsing context.