From a5df5070e02304966ee4a28dda88798b4cced581 Mon Sep 17 00:00:00 2001
From: Luke Warlow closedby
open
dialog
element is active and that the user can interact with it.
The closedby
+ content attribute is an enumerated attribute with the following keywords and
+ states:
Keyword + | State + | Brief description + |
---|---|---|
any
+ | any + | Close requests or clicking outside closes the dialog + |
closerequest
+ | closerequest + | Close requests close the dialog + |
none
+ | none + | Nothing automatically closes the dialog + |
No corresponding keyword + | auto + | Same as closerequest when modal or none when not + |
The closedby
attribute's invalid value default and missing value
+ default are both the auto state.
A dialog
element without an open
attribute
@@ -61153,6 +61188,29 @@ interface HTMLDialogElement : HTMLElement {
Add an open
attribute to this, whose
value is the empty string.
If this's closedby
attribute state
+ is any or closerequest then:
Set this's close watcher to the + result of establishing a close watcher given + this's relevant global object, with:
+ +cancelAction being to return the
+ result of firing an event named cancel
at this, with the cancelable
attribute initialized to true.
closeAction being to close the + dialog given this and null.
Set this's previously focused element to the focused element.
Set this's close watcher to the - result of establishing a close watcher given - this's relevant global object, with:
+If this's closedby
attribute state
+ is not none then:
cancelAction being to return the
- result of firing an event named cancel
at this, with the cancelable
attribute initialized to true.
Set this's close watcher to the + result of establishing a close watcher given + this's relevant global object, with:
-closeAction being to close the - dialog given this and null.
cancelAction being to return the
+ result of firing an event named cancel
at this, with the cancelable
attribute initialized to true.
closeAction being to close + the dialog given this and null.
Set this's previously focused element to the @@ -61264,6 +61328,48 @@ interface HTMLDialogElement : HTMLElement {
Set topDocument's autofocus processed flag to true.
To get the showing any dialog list for a
+ Document
document:
Let dialogs be « ».
For each Element
element in
+ document's top layer: if element is a dialog element
, element's closedby
attribute is in the any state and element has an open
attribute, then append
+ element to dialogs.
Return dialogs.
To find the nearest inclusive open dialog given a Node
+ node, perform the following steps. They return an HTML dialog element or null.
Let currentNode be node.
While currentNode is not null:
+ +If currentNode is an HTML dialog
+ element, currentNode's closedby
+ attribute is in the any state and
+ currentNode has an open
attribute, then
+ return currentNode.
Set currentNode to currentNode's parent in the flat + tree.
Return null.
The dialog
HTML element removing steps, given removedNode
and oldParent, are:
The Document
has a dialog pointerdown target, which is an HTML dialog element or null, initially null.
Each dialog
element has a close watcher,
which is a close watcher or null, initially null.
The following attribute change + steps, given element, localName, oldValue, + value, and namespace, are used for HTML + dialog elements:
+ +If namespace is not null, then return.
If localName is not closedby
, then
+ return.
If element has no open attribute, then + return.
If oldValue and value are in the same state, then return.
If value is in the none state + or auto state and element's is + modal flag is false then:
+If element's close watcher is not + null, then:
+ +Destroy element's close watcher.
Set element's close watcher to + null.
If value is in the closerequest state, any state, or auto state and element's is + modal flag is true then:
+If element's close watcher is null, + then:
+ +Set element's close watcher to + the result of establishing a close watcher + given element's relevant global object, with:
+ +cancelAction being to return the
+ result of firing an event named cancel
at element, with the cancelable
attribute initialized to true.
closeAction being to close + the dialog given element and null.
The closedBy
IDL attribute must reflect the
+ closedby
content attribute, limited to only
+ known values.
The open
IDL
attribute must reflect the open
content
attribute.
"Light dismiss" means that clicking outside of a dialog whose closedby
attribute is in the any state will close the dialog. This is in addition to
+ how such dialogs respond to close requests.
To light dismiss open dialogs, given an Event
event:
Assert: event's isTrusted
attribute is true.
Let target be event's target.
Let document be target's node document.
If document's showing any dialog list is empty, then + return.
If event is a PointerEvent
and event's type
is "pointerdown
",
+ then: set document's dialog pointerdown target to the result of running
+ topmost clicked dialog given target.
If event is a PointerEvent
and event's type
is "pointerup
",
+ then:
Let clickedDialog be the result of running topmost clicked + dialog given target.
Let topDialog be document's showing any dialog + list's last element.
Let clickedTopDialog be clickedDialog is topDialog, or + clickedDialog is dialog pointerdown target
Set document's dialog pointerdown target to null.
If clickedTopDialog, then return.
Perform close the dialog given topDialog.
Light dismiss open dialogs will be called by the Pointer Events spec when the user clicks + or touches anywhere on the page.
+ +To find the topmost clicked dialog, given a Node
node:
Let clickedDialog be the result of running nearest inclusive open + dialog given node.
Return clickedDialog