From 04c3483663f52beaaddfdf09bdf2fe5ee4b5d8f6 Mon Sep 17 00:00:00 2001
From: Jake Archibald Let document be this's node document. Let hideUntil be the result of running topmost popover ancestor
- given this, document's showing hint popover list, null, and
- false. If hideUntil is null, then set hideUntil to the result of running
- topmost popover ancestor given this, document's
- showing auto popover list, null, and false.
If hideUntil is null, then set hideUntil to document.
Run hide all popovers until given - hideUntil, false, and true.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Run the dialog focusing steps given this.
Let document be subject's node document.
Let hideUntil be the result of running topmost popover ancestor - given subject, document's showing hint popover list, null, and - false.
If hideUntil is null, then set hideUntil to the result of running - topmost popover ancestor given subject, document's - showing auto popover list, null, and false.
If hideUntil is null, then set hideUntil to document.
Run hide all popovers until given - hideUntil, false, and true.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Run the dialog focusing steps given subject.
If the result of running check popover validity given element, false, throwExceptions, and null is false, then return.
Let checkAncestor be the following steps:
+ +Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true.
If ancestor is not null, element's popover attribute is in the Auto state, and ancestor's popover attribute is in the Hint state, then:
+
If throwExceptions is true, then throw an
+ "InvalidStateError" DOMException.
Return false.
Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'.
+If the result of running checkAncestor is false, then return.
Let document be element's node document.
Assert: element's popover trigger is null.
popover attribute.
- Let shouldRestoreFocus be false.
Let originalType be the current state of element's popover attribute.
Let stackToAppendTo be null.
Let autoAncestor be the result of running the topmost popover - ancestor algorithm given element, document's showing auto - popover list, source, and true.
Let hintAncestor be the result of running the topmost popover - ancestor algorithm given element, document's showing hint - popover list, source, and true.
If originalType is the Auto state, - then:
- -Run close entire popover list given document's showing - hint popover list, shouldRestoreFocus, and fireEvents.
Let ancestor be the result of running the topmost popover - ancestor algorithm given element, document's showing auto - popover list, source, and true.
If ancestor is null, then set ancestor to - document.
Run hide all popovers until given - ancestor, shouldRestoreFocus, and fireEvents.
If the result of running checkAncestor is false, then run cleanupShowingFlag and return.
-Set stackToAppendTo to "auto".
These checks are performed again because firing the beforetoggle event could have modified element state.
If originalType is the Hint state, - then:
- -If hintAncestor is not null, then:
- -Run hide all popovers until given - hintAncestor, shouldRestoreFocus, and fireEvents.
Set stackToAppendTo to "hint".
Otherwise:
- -Run close entire popover list given document's showing - hint popover list, shouldRestoreFocus, and fireEvents.
Let shouldRestoreFocus be false.
If autoAncestor is not null, then:
+Let originalType be the current state of element's popover attribute.
Run hide all popovers until given - autoAncestor, shouldRestoreFocus, and fireEvents.
Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true.
Set stackToAppendTo to "auto".
If originalType is the Auto or Hint state, then run hide popover stack until given ancestor, document, Hint, shouldRestoreFocus, and fireEvents.
Otherwise, set stackToAppendTo to "hint".
If originalType is the Auto state, then run hide popover stack until given ancestor, document, Auto, shouldRestoreFocus, and fireEvents.
If originalType is Auto or Hint, then:
Assert: stackToAppendTo is not null.
If originalType is not equal to the value of element's popover attribute, then:
Check popover validity is called again because running hide all popovers until above could have fired the +
Check popover validity is called again because running hide popover stack until above could have fired the
beforetoggle event, and an event handler could have
disconnected this element or changed its popover
attribute.
If the result of running checkAncestor is false, then run cleanupShowingFlag and return.
+ +These checks are performed again because running hide popover stack until above could have fired the beforetoggle event, and an event handler could have altered DOM state.
If the result of running topmost auto or hint popover on document is null, then set shouldRestoreFocus to @@ -91412,7 +91374,7 @@ dictionary DragEventInit : MouseEventInit {
If stackToAppendTo is "auto":
If originalType is Auto:
Assert: document's showing auto popover list does @@ -91425,8 +91387,7 @@ dictionary DragEventInit : MouseEventInit {
Otherwise:
Assert: stackToAppendTo is "hint".
Assert: originalType is Hint.
Assert: document's showing hint popover list does not contain element.
If originalType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
Queue a popover toggle event task given element, "closed", "open", and source.
hint", then:
Run hide all popovers until given +
Run hide all popovers until TODO FIX given element, focusPreviousElement, and fireEvents.
Check popover validity is called again because running hide all popovers until could have disconnected +
Check popover validity is called again because running hide all popovers until TODO fix could have disconnected
element or changed its popover attribute.
If autoPopoverListContainsElement is true and document's - showing auto popover list's last item is not element, then run hide all popovers until given element, + showing auto popover list's last item is not element, then run hide all popovers until TODO fix given element, focusPreviousElement, and false.
To hide all popovers until, given an HTML element or Document endpoint, a boolean
- focusPreviousElement, and a boolean fireEvents:
To hide popover stack until, given an HTML
+ element or null endpoint, Document document,
+ an Auto or Hint stackType,
+ a boolean focusPreviousElement, and a boolean fireEvents:
If endpoint is an HTML element and - endpoint is not in the popover showing - state, then return.
Let popoverList be document's showing auto popover list if stackType is Auto, otherwise document's showing hint popover list.
Let document be endpoint's node document.
Let lastHideIndex be 0 if popoverList does not contain endpoint, otherwise the index of endpoint in popoverList plus 1.
Assert: endpoint is a Document or
- endpoint's popover visibility state is showing.
Assert: endpoint is a Document or
- endpoint's popover attribute is in the Auto state or endpoint's popover attribute is in the Hint state.
If endpoint is a Document:
Run close entire popover list given document's showing - hint popover list, focusPreviousElement, and fireEvents.
Run close entire popover list given document's showing - auto popover list, focusPreviousElement, and fireEvents.
Return.
If document's showing hint popover list contains - endpoint:
- -Assert: endpoint's popover
- attribute is in the Hint state.
Run hide popover stack until given endpoint, - document's showing hint popover list, focusPreviousElement, - and fireEvents.
Return.
Let toHide be a slice of popoverList from index lastHideIndex.
Run close entire popover list given document's showing hint - popover list, focusPreviousElement, and fireEvents.
Reverse toHide.
If document's showing auto popover list does not contain - endpoint, then return.
Let toRemain be a slice of popoverList from index 0 to lastHideIndex.
Run hide popover stack until given endpoint, document's - showing auto popover list, focusPreviousElement, and - fireEvents.
For each popover in toHide, run the hide popover algorithm given popover, focusPreviousElement, fireEvents, false, and null.
To hide popover stack until, given an HTML - element endpoint, a list popoverList, a boolean - focusPreviousElement, and a boolean fireEvents:
+Let newPopoverList be document's showing auto popover list if stackType is Auto, otherwise document's showing hint popover list.
Let repeatingHide be false.
Reverse newPopoverList.
Perform the following steps at least once:
+For each popover in newPopoverList:
Let lastToHide be null.
If toRemain contains popover, then continue.
For each popover in popoverList:
- -If popover is endpoint, then break.
Run the hide popover algorithm given popover, focusPreviousElement, false, false, and null.
-Set lastToHide to popover.
This happens if popovers are shown whilst hiding popovers. For example, in beforetoggle events. This is usually a developer error, so user agents are encouraged to show a warning. In this additional hiding phase, fireEvents is ignored, and false is used instead.
If lastToHide is null, then return.
While lastToHide's popover visibility state is showing:
- -Assert: popoverList is not empty.
Run the hide popover algorithm given the last item in - popoverList, focusPreviousElement, fireEvents, false, and - null.
Assert: repeatingHide is false or popoverList's last - item is endpoint.
Set repeatingHide to true if popoverList contains - endpoint and popoverList's last item is not endpoint, - otherwise false.
If repeatingHide is true, then set fireEvents to false.
and keep performing them while repeatingHide is true.
The hide all popovers until - algorithm is used in several cases to hide all popovers that don't stay open when something +
The hide all popovers until + algorithm TODO fix is used in several cases to hide all popovers that don't stay open when something happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only the popovers that aren't related to the node clicked by the user.
To find the topmost popover ancestor, given a Node
- newPopoverOrTopLayerElement, a list popoverList, an newPopoverOrTopLayerElement, an HTML element or null source, and a boolean
isPopover, perform the following steps. They return an HTML element or null.
The topmost popover ancestor algorithm will return the topmost (latest in the - showing auto popover list) ancestor popover for the provided popover or top layer +
The topmost popover ancestor algorithm will return the topmost ancestor popover for the provided popover or top layer element. Popovers can be related to each other in several ways, creating a tree of popovers. There are two paths through which one popover (call it the "child" popover) can have a topmost ancestor popover (call it the "parent" popover):
@@ -91856,18 +91737,18 @@ dictionary DragEventInit : MouseEventInit {The popovers are nested within each other in the node tree. In this case, the descendant popover is the "child" and its topmost ancestor popover is the "parent".
A popover trigger element (e.g., a button) has a popovertarget attribute pointing to a popover. In this case,
+
An element is the 'source' of the popover (e.g., a button with command in the Show Popover state). In this case,
the popover is the "child", and the popover subtree the trigger element is in is the
"parent". The trigger element has to be in a popover and reference an open popover.
In each of the relationships formed above, the parent popover has to be strictly earlier in - the showing auto popover list than the child popover, or it does not form a valid + the showing auto popover list or showing hint popover list than the child popover, or it does not form a valid ancestral relationship. This eliminates non-showing popovers and self-pointers (e.g., a popover containing an invoking element that points back to the containing popover), and it allows for the construction of a well-formed tree from the (possibly cyclic) graph of connections. Only Auto popovers are considered.
+ data-x="attr-popover-auto-state">Auto and Hint popovers are considered.If the provided element is a top layer element such as a dialog which is not
showing as a popover, then topmost popover ancestor will only look in the node tree
@@ -91901,81 +91782,21 @@ dictionary DragEventInit : MouseEventInit {
-
Let popoverPositions be an empty ordered map.
Let index be 0.
Let document be newPopoverOrTopLayerElement's node document.
For each popover of popoverList:
+Let combinedPopovers be document's showing auto popover list extended with document's showing hint popover list.
Set popoverPositions[popover] to - index.
Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement is a flat tree descendant, otherwise infinity.
Increment index by 1.
Let sourceAncestorIndex be infinity.
If isPopover is true, then set - popoverPositions[newPopoverOrTopLayerElement] to index.
If source is not null, then set sourceAncestorIndex to the index of the last item in combinedPopovers of which source is a flat tree descendant, otherwise infinity.
Increment index by 1.
Let ancestorIndex be the minimum of popoverAncestorIndex and sourceAncestorIndex.
Let topmostPopoverAncestor be null.
If ancestorIndex is infinity, then return null.
Let checkAncestor be an algorithm which performs the following steps given - candidate:
- -If candidate is null, then return.
Let okNesting be false.
Let candidateAncestor be null.
While okNesting is false:
- -Set candidateAncestor to the result of running nearest inclusive open - popover given candidate.
If candidateAncestor is null or popoverPositions does not - contain candidateAncestor, then return.
Assert: candidateAncestor's popover attribute is not in the Manual or None state.
Set okNesting to true if isPopover is false,
- newPopoverOrTopLayerElement's popover attribute
- is in the Hint state, or
- candidateAncestor's popover attribute is in the
- Auto state.
If okNesting is false, then set candidate to - candidateAncestor's parent in the flat tree.
Let candidatePosition be - popoverPositions[candidateAncestor].
If topmostPopoverAncestor is null or - popoverPositions[topmostPopoverAncestor] is less than - candidatePosition, then set topmostPopoverAncestor to - candidateAncestor.
Run checkAncestor given newPopoverOrTopLayerElement's parent node - within the flat tree.
Run checkAncestor given source.
Return topmostPopoverAncestor.
Return combinedPopovers[ancestorIndex].
Each Document has a hint stack parent, which is an
+ HTML element or null, initially null.
The hint stack parent tracks which item in the showing auto popover list is the 'parent' of the first item in the showing hint popover list, or null if the first item in showing hint popover list is not 'child' to an item in the showing auto popover list.
+ +Therefore, when the hint stack parent is not null, it will have an opened in popover mode of "auto".
To close entire popover list given a list popoverList, a boolean focusPreviousElement, and a boolean fireEvents:
While popoverList is not empty:
+While popoverList is not empty:
Run the hide popover algorithm given popoverList's last item, @@ -92414,8 +92244,8 @@ dictionary DragEventInit : MouseEventInit {
If ancestor is null, then set ancestor to document.
If sameTarget is true, then run hide - all popovers until given ancestor, false, and true.
If sameTarget is true, then run hide + all popovers until TODO fix given ancestor, false, and true.
If the result of running topmost auto or hint
+ If the result of running topmost auto or hint
popover on document is null, then set shouldRestoreFocus to
true.
Let autoPopoverListContainsElement be true if document's showing auto popover list contains element.
Let hintPopoverListContainsElement be true if document's showing hint popover list contains element.
If element's opened in popover mode is "auto"
or "hint", then:
Run hide all popovers until TODO FIX given - element, focusPreviousElement, and fireEvents.
If hintPopoverListContainsElement is true, then hide popover stack until given element, document, Hint, focusPreviousElement, and fireEvents.
If element is document's hint stack parent, then hide popover stack until given null, document, Hint, focusPreviousElement, and fireEvents.
+ +If the document's hint stack parent is to hide, then all hint popovers are hidden.
+If autoPopoverListContainsElement is true, then hide popover stack until given element, document, Auto, focusPreviousElement, and fireEvents.
If the result of running check popover validity given element, true, throwExceptions, and null is false, then run cleanupSteps and return.
-Check popover validity is called again because running hide all popovers until TODO fix could have disconnected +
Check popover validity is called again because running hide popover stack until could have disconnected
element or changed its popover attribute.
Let autoPopoverListContainsElement be true if document's - showing auto popover list's last item is element, otherwise - false.
If fireEvents is true:
@@ -91576,9 +91583,17 @@ dictionary DragEventInit : MouseEventInit { data-x="dom-ToggleEvent-source">source attribute set to source at element.If autoPopoverListContainsElement is true and document's - showing auto popover list's last item is not element, then run hide all popovers until TODO fix given element, - focusPreviousElement, and false.
If autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, then run hide popover stack until given element, document, Auto, focusPreviousElement, and false.
+ +This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given element, document, Hint, focusPreviousElement, and false.
+ +This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
If the result of running check popover validity given element, @@ -91607,6 +91622,8 @@ dictionary DragEventInit : MouseEventInit {
Set element's popover visibility state to hidden.
If element is document's hint stack parent, or document's showing hint popover list is empty, then set document's hint stack parent to null.
If fireEvents is true, then queue a popover toggle event task
given element, "open", "closed", and
source.
To find the topmost auto or hint popover given a +
To find the topmost auto or hint popover given a
Document document, perform the following steps. They return an HTML element or null.
Therefore, when the hint stack parent is not null, it will have an opened in popover mode of "auto".
To close entire popover list given a list popoverList, a - boolean focusPreviousElement, and a boolean fireEvents:
- -While popoverList is not empty:
- -Run the hide popover algorithm given popoverList's last item, - focusPreviousElement, fireEvents, false, and null.
Buttons may have the following content attributes:
@@ -92202,7 +92203,7 @@ dictionary DragEventInit : MouseEventInit {"Light dismiss" means that clicking outside of a popover whose popover attribute is in the Auto state will close the popover. This is in addition to
+ data-x="attr-popover-auto-state">Auto or Hint state will close the popover. This is in addition to
how such popovers respond to close requests.
Let document be target's node document.
Let topmostPopover be the result of running topmost auto popover - given document.
If topmostPopover is null, then return.
If the result of running topmost auto or hint popover given document is null, then return.
If event's Set document's popover pointerdown target to null. If ancestor is null, then set ancestor to
- document. If sameTarget is false, then return Run hide popover stack until given ancestor, document, Hint, false, and true. If sameTarget is true, then run hide
- all popovers until TODO fix given ancestor, false, and true. Run hide popover stack until given ancestor, document, Auto, false, and true.type is "pointerdown", then: set document's popover
@@ -92241,11 +92239,11 @@ dictionary DragEventInit : MouseEventInit {
Let hideUntil be the result of running topmost popover ancestor given this, null, and false.
If hideUntil is null, then set hideUntil to - document.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Let hideUntil be the result of running topmost popover ancestor given subject, null, and false.
If hideUntil is null, then set hideUntil to - document.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'.
+ +Return true.
If ancestor is not null, element's popover attribute is in the Auto state, and ancestor's popover attribute is in the Hint state, then:
+ data-x="attr-popover">popover attribute is in the Hint state:
Let popoverList be document's showing auto popover list if stackType is Auto, otherwise document's showing hint popover list.
Let popoverList be document's showing auto popover list if stackType is Auto; otherwise document's showing hint popover list.
Let lastHideIndex be 0 if popoverList does not contain endpoint, otherwise the index of endpoint in popoverList plus 1.
Let lastHideIndex be 0 if popoverList does not contain endpoint; otherwise the index of endpoint in popoverList plus 1.
Let toHide be a slice of popoverList from index lastHideIndex.
Let toRemain be a slice of popoverList from index 0 to lastHideIndex.
For each popover in toHide, run the hide popover algorithm given popover, focusPreviousElement, fireEvents, false, and null.
For each popover of toHide: run the hide popover algorithm given popover, focusPreviousElement, fireEvents, false, and null.
Let newPopoverList be document's showing auto popover list if stackType is Auto, otherwise document's showing hint popover list.
Let newPopoverList be document's showing auto popover list if stackType is Auto; otherwise document's showing hint popover list.
Reverse newPopoverList.
The hide all popovers until +
The hide popover stack until algorithm TODO fix is used in several cases to hide all popovers that don't stay open when something happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only the popovers that aren't related to the node clicked by the user.
From 8f4f8fd152fce7bb9c9b9ac99bf5593a91b2bf7b Mon Sep 17 00:00:00 2001 From: Jake ArchibaldIf autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, then run hide popover stack until given element, document, Auto, focusPreviousElement, and false.
+If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given element, document, Hint, focusPreviousElement, and false.
This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given element, document, Hint, focusPreviousElement, and false.
+Otherwise, if autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, run hide popover stack until given element, document, Auto, focusPreviousElement, and false.
This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
The hide popover stack until - algorithm TODO fix is used in several cases to hide all popovers that don't stay open when something + algorithm is used in several cases to hide all popovers that don't stay open when something happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only the popovers that aren't related to the node clicked by the user.
From afc6003c15d99743b3c5511a7bf6bd5b44418bd6 Mon Sep 17 00:00:00 2001 From: Jake ArchibaldLet hideUntil be the result of running topmost popover ancestor given this, null, and false.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Run hide popovers until given hideUntil, document, false, and true.
Run the dialog focusing steps given this.
Let hideUntil be the result of running topmost popover ancestor given subject, null, and false.
Run hide popover stack until given hideUntil, document, Hint, false, and true.
Run hide popover stack until given hideUntil, document, Auto, false, and true.
Run hide popovers until given hideUntil, document, false, and true.
Run the dialog focusing steps given subject.
To hide popovers until, given an HTML
+ element or null endpoint, Document document,
+ a boolean focusPreviousElement, and a boolean fireEvents:
Run hide popover stack until given endpoint, document, Hint, focusPreviousElement, and fireEvents.
Run hide popover stack until given endpoint, document, Auto, focusPreviousElement, and fireEvents.
To hide popover stack until, given an HTML
element or null endpoint, Document document,
@@ -92237,9 +92245,7 @@ dictionary DragEventInit : MouseEventInit {
If sameTarget is false, then return
Run hide popover stack until given ancestor, document, Hint, false, and true.
Run hide popover stack until given ancestor, document, Auto, false, and true.
Run hide popovers given ancestor, document, false, and true.
Run hide popover stack until given endpoint, document, Hint, focusPreviousElement, and fireEvents.
Run hide popover stack until given endpoint, document, Hint, focusPreviousElement, and fireEvents.
Run hide popover stack until given endpoint, document, Auto, focusPreviousElement, and fireEvents.
Run hide popover stack until given endpoint, document, Auto, focusPreviousElement, and fireEvents.
If sameTarget is false, then return
Run hide popovers given ancestor, document, false, and true.
Run hide popovers until given ancestor, document, false, and true.
Let endpointIsHint be true if document's showing hint popover list contains endpoint; otherwise false.
Run hide popover stack until given endpoint, document, Hint, focusPreviousElement, and fireEvents.
If endpointIsHint, then return.
Run hide popover stack until given endpoint, document, Auto, focusPreviousElement, and fireEvents.
Let lastHideIndex be 0 if popoverList does not contain endpoint; otherwise the index of endpoint in popoverList plus 1.
Let toHide be a slice of popoverList from index lastHideIndex.
Let toHide be a slice of popoverList from lastHideIndex, in reverse order.
Reverse toHide.
Let toRemain be a slice of popoverList from index 0 to lastHideIndex.
Let toRemain be a slice of popoverList from 0 to lastHideIndex.
For each popover of toHide: run the hide popover algorithm given popover, focusPreviousElement, fireEvents, false, and null.
Let hideUntil be the result of running topmost popover ancestor given this, null, and false.
Run hide popovers until given hideUntil, document, false, and true.
Run hide popovers until given document, hideUntil, false, and true.
Run the dialog focusing steps given this.
Let hideUntil be the result of running topmost popover ancestor given subject, null, and false.
Run hide popovers until given hideUntil, document, false, and true.
Run hide popovers until given document, hideUntil, false, and true.
Run the dialog focusing steps given subject.
Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true.
If originalType is the Auto or Hint state, then run hide popover stack until given ancestor, document, Hint, shouldRestoreFocus, and fireEvents.
If originalType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and fireEvents.
If originalType is the Auto state, then run hide popover stack until given ancestor, document, Auto, shouldRestoreFocus, and fireEvents.
If originalType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and fireEvents.
If originalType is Auto or DragEventInit : MouseEventInit {
or "hint", then:
If hintPopoverListContainsElement is true, then hide popover stack until given element, document, Hint, focusPreviousElement, and fireEvents.
If hintPopoverListContainsElement is true, then hide popover stack until given document, element, Hint, focusPreviousElement, and fireEvents.
If element is document's hint stack parent, then hide popover stack until given null, document, Hint, focusPreviousElement, and fireEvents.
+If element is document's hint stack parent, then hide popover stack until given document, null, Hint, focusPreviousElement, and fireEvents.
If the document's hint stack parent is to hide, then all hint popovers are hidden.
If autoPopoverListContainsElement is true, then hide popover stack until given element, document, Auto, focusPreviousElement, and fireEvents.
If autoPopoverListContainsElement is true, then hide popover stack until given document, element, Auto, focusPreviousElement, and fireEvents.
If the result of running check popover validity given element, @@ -91580,13 +91580,13 @@ dictionary DragEventInit : MouseEventInit { element.
If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given element, document, Hint, focusPreviousElement, and false.
+If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given document, element, Hint, focusPreviousElement, and false.
This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
Otherwise, if autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, run hide popover stack until given element, document, Auto, focusPreviousElement, and false.
+Otherwise, if autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, run hide popover stack until given document, element, Auto, focusPreviousElement, and false.
This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
To hide popovers until, given an HTML
- element or null endpoint, Document document,
- a boolean focusPreviousElement, and a boolean fireEvents:
To hide popovers until, given a Document document, an HTML element or null endpoint, a boolean focusPreviousElement, and a boolean fireEvents:
Let endpointIsHint be true if document's showing hint popover list contains endpoint; otherwise false.
Run hide popover stack until given endpoint, document, Hint, focusPreviousElement, and fireEvents.
Run hide popover stack until given document, endpoint, Hint, focusPreviousElement, and fireEvents.
If endpointIsHint, then return.
Run hide popover stack until given endpoint, document, Auto, focusPreviousElement, and fireEvents.
Run hide popover stack until given document, endpoint, Auto, focusPreviousElement, and fireEvents.
To hide popover stack until, given an HTML
- element or null endpoint, Document document,
- an Auto or Hint stackType,
- a boolean focusPreviousElement, and a boolean fireEvents:
To hide popover stack until, given a Document document, an HTML element or null endpoint, an Auto or Hint stackType, a boolean focusPreviousElement, and a boolean fireEvents:
Let popoverList be document's showing auto popover list if stackType is Auto; otherwise document's showing hint popover list.
If sameTarget is false, then return
Run hide popovers until given ancestor, document, false, and true.
Run hide popovers until given document, ancestor, false, and true.
Add an element to the top layer given element.
If originalType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
Set element's popover visibility state to showing.
If originalType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
Queue a popover toggle event task given element, "closed", "open", and source.
Let autoPopoverListContainsElement be true if document's showing auto popover list contains element.
Let autoPopoverListContainsElement be true if document's showing auto popover list contains element; otherwise false.
Let hintPopoverListContainsElement be true if document's showing hint popover list contains element.
Let hintPopoverListContainsElement be true if document's showing hint popover list contains element; otherwise false.
If element's opened in popover mode is "auto"
From 2dbb9bf71495872a5c7f298e282311ce35422a05 Mon Sep 17 00:00:00 2001
From: Jake Archibald
Set element's popover showing or hiding to true.
Let cleanupShowingFlag be the following steps:
+Let cleanupShowingSteps be the following steps:
If nestedShow is false, then set element's popover showing
@@ -91296,12 +91296,12 @@ dictionary DragEventInit : MouseEventInit {
data-x="">closed", the newState attribute
initialized to "open", and the source attribute initialized to source at
- element is false, then run cleanupShowingFlag and return.
If the result of running check popover validity given element, false, throwExceptions, and document is false, then run - cleanupShowingFlag and return.
+ cleanupShowingSteps and return.Check popover validity is called again because firing the beforetoggle event could have disconnected this element or
@@ -91309,7 +91309,7 @@ dictionary DragEventInit : MouseEventInit {
If the result of running checkAncestor is false, then run cleanupShowingFlag and return.
+If the result of running checkAncestor is false, then run cleanupShowingSteps and return.
These checks are performed again because firing the beforetoggle event could have modified element state.
If the result of running check popover validity given element, false, throwExceptions, and document is false, then run - cleanupShowingFlag and return.
+ cleanupShowingSteps and return.Check popover validity is called again because running hide popover stack until above could have fired the
beforetoggle event, and an event handler could have
@@ -91355,7 +91355,7 @@ dictionary DragEventInit : MouseEventInit {
If the result of running checkAncestor is false, then run cleanupShowingFlag and return.
+If the result of running checkAncestor is false, then run cleanupShowingSteps and return.
These checks are performed again because running hide popover stack until above could have fired the beforetoggle event, and an event handler could have altered DOM state.
Queue a popover toggle event task given element, "closed", "open", and source.
Run cleanupShowingFlag.
Run cleanupShowingSteps.
If sameTarget is false, then return
Run hide popovers until given document, ancestor, false, and true.
Let endpointIsHint be true if document's showing hint popover list contains ancestor; otherwise false.
Run hide popover stack until given document, ancestor, Hint, false, and true.
Let autoEndpoint be ancestor.
If endpointIsHint, then set autoEndpoint to document's hint stack parent.
+ +This means, if a hint popover is clicked, auto popovers are closed, except those that are parent to the clicked hint popover.
+Run hide popover stack until given document, autoEndpoint, Auto, false, and true.
Let combinedPopovers be document's showing auto popover list extended with document's showing hint popover list.
Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement is a flat tree descendant, otherwise infinity.
Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement is a flat tree descendant, otherwise -1.
Let sourceAncestorIndex be infinity.
Let sourceAncestorIndex be -1.
If source is not null, then set sourceAncestorIndex to the index of the last item in combinedPopovers of which source is a flat tree descendant, otherwise infinity.
If source is not null, then set sourceAncestorIndex to the index of the last item in combinedPopovers of which source is a flat tree descendant, otherwise -1.
Let ancestorIndex be the minimum of popoverAncestorIndex and sourceAncestorIndex.
Let ancestorIndex be the maximum of popoverAncestorIndex and sourceAncestorIndex.
If ancestorIndex is infinity, then return null.
If ancestorIndex is -1, then return null.
Return combinedPopovers[ancestorIndex].
Every HTML element has an opened in popover - mode, which is a string or null, initially null.
+ mode, which is "auto", "hint", or null,
+ initially null.
The following attribute change
@@ -91238,34 +91239,6 @@ dictionary DragEventInit : MouseEventInit {
If the result of running check popover validity given element,
false, throwExceptions, and null is false, then return. Let checkAncestor be the following steps: Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true. If ancestor is not null, element's If throwExceptions is true, then throw an
- " Return false. Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. Return true. If the result of running checkAncestor is false, then return. Let document be element's node document. Assert: element's popover trigger is null.
-
- popover attribute is in the Auto state, and ancestor's popover attribute is in the Hint state:
-
-
-
- InvalidStateError" DOMException.popover attribute.
If the result of running checkAncestor is false, then run cleanupShowingSteps and return.
- -These checks are performed again because firing the beforetoggle event could have modified element state.
Let shouldRestoreFocus be false.
Let originalType be the current state of element's Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true. If originalType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and fireEvents. Let effectiveType be originalType. If originalType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and fireEvents. If all of the following are true: ancestor is not null; ancestor's opened in popover mode is " effectiveType is the Auto state, then set effectiveType to the Hint state. Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. To resolve this case, the effectiveType is 'downgraded' to Hint. If effectiveType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and fireEvents. If effectiveType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and fireEvents. If originalType is Auto or If effectiveType is Auto or Hint, then:DragEventInit : MouseEventInit {
+
+
+ hint"; and
@@ -91354,12 +91338,6 @@ dictionary DragEventInit : MouseEventInit {
attribute.
If the result of running checkAncestor is false, then run cleanupShowingSteps and return.
- -These checks are performed again because running hide popover stack until above could have fired the beforetoggle event, and an event handler could have altered DOM state.
If the result of running topmost auto or hint popover on document is null, then set shouldRestoreFocus to @@ -91370,7 +91348,7 @@ dictionary DragEventInit : MouseEventInit {
If originalType is Auto:
+If effectiveType is Auto:
Assert: document's showing auto popover list does @@ -91383,7 +91361,7 @@ dictionary DragEventInit : MouseEventInit {
Otherwise:
Assert: originalType is Hint.
Assert: effectiveType is Hint.
Assert: document's showing hint popover list does not contain element.
Add an element to the top layer given element.
If originalType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
If effectiveType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
Set element's popover visibility state to showing.
While currentNode is not null:
If currentNode's popover attribute is in
- the Auto state or the Hint state, and currentNode's
- popover visibility state is showing,
- then return currentNode.
If currentNode's opened in popover mode is "auto" or "hint", and currentNode's popover visibility state is showing, then return currentNode.
Set currentNode to currentNode's parent in the flat tree.
Every HTML element has a popover trigger, which is an HTML element or null, initially set to null.
-Every HTML element has a popover showing or - hiding, which is a boolean, initially set to false.
+Every HTML element has a popover hiding, which is a boolean, initially set to false.
Every HTML element popover toggle task tracker, which is a toggle task tracker or null, initially null.
@@ -91174,6 +91173,10 @@ dictionary DragEventInit : MouseEventInit { mode, which is "auto", "hint", or null,
initially null.
+ Every Document has a hiding popover nesting count, which is a number, initially 0.
Every Document has a showing popover, which is a boolean, initially false.
The following attribute change steps, given element, localName, oldValue, @@ -91236,29 +91239,34 @@ dictionary DragEventInit : MouseEventInit { element or null source:
Let document be element's node document.
If document's showing popover is true, then:
+ +If throwExceptions is true, then throw a "InvalidStateError"
+ DOMException.
Return.
Set document's showing popover to true.
If the result of running check popover validity given element, false, throwExceptions, and null is false, then return.
Let document be element's node document.
Assert: element's popover trigger is null.
Assert: element is not in document's top layer.
Let nestedShow be element's popover showing or - hiding.
Let fireEvents be the boolean negation of nestedShow.
Set element's popover showing or hiding to true.
Let cleanupShowingSteps be the following steps:
If nestedShow is false, then set element's popover showing - or hiding to false.
Set document's showing popover to false.
Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. To resolve this case, the effectiveType is 'downgraded' to Hint.
-If effectiveType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and fireEvents.
If effectiveType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and true.
If effectiveType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and fireEvents.
If effectiveType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and true.
If effectiveType is Auto or DragEventInit : MouseEventInit { data-x="attr-popover-none-state">No Popover state, then set element's previously focused element to originallyFocusedElement.
Run cleanupShowingSteps.
Queue a popover toggle event task given element, "closed", "open", and source.
Run cleanupShowingSteps.
Let document be element's node document.
Let nestedHide be element's popover showing or - hiding.
Let nestedHide be element's popover hiding.
Set element's popover showing or hiding to true.
Set element's popover hiding to true.
If nestedHide is true, then set fireEvents to false.
Let cleanupSteps be the following steps:
If nestedHide is false, then set element's popover showing - or hiding to false.
If nestedHide is false, then set element's popover hiding to false.
If element's popover close watcher is not null, then:
From 7ca5f3d4f0b4aab88806d4d8e3c1efd8032b4009 Mon Sep 17 00:00:00 2001 From: Jake ArchibaldLet document be element's node document.
If document's showing popover is true, then:
+If document's showing popover is true, or document's hiding popover nesting count is not 0, then:
If throwExceptions is true, then throw a "InvalidStateError"
@@ -91250,6 +91250,8 @@ dictionary DragEventInit : MouseEventInit {
Return.
This prevents showing a popover during the show or hide of another popover.
Set document's showing popover to true.
If nestedHide is true, then set fireEvents to false.
Increment document's hiding popover nesting count.
Let cleanupSteps be the following steps:
@@ -91518,6 +91522,8 @@ dictionary DragEventInit : MouseEventInit {Set element's popover close watcher to null.
Decrement document's hiding popover nesting count.
If hintPopoverListContainsElement is true and document's showing hint popover list's last item is not element, then run hide popover stack until given document, element, Hint, focusPreviousElement, and false.
- -This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
Otherwise, if autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, run hide popover stack until given document, element, Auto, focusPreviousElement, and false.
- -This happens if popovers are shown during the beforetoggle event. This is usually a developer error, so user agents are encouraged to show a warning.
If the result of running check popover validity given element,
true, throwExceptions, and null is false, then run cleanupSteps and
From c6a01ba53a047e96a2f0047787b6cd46efeae8ac Mon Sep 17 00:00:00 2001
From: Jake Archibald
If the result of running check popover validity given - target, true, false, and null is true, then run the - hide popover algorithm given target, true, true, false, and - element.
Let validity be the result of running check popover validity given target, true, and null. If this throws an exception, catch it, and let validity be false.
If validity is true, then run the hide popover algorithm given target, true, true, false, and element.
If the result of running check popover validity given - target, false, false, and null is true, then run the - show popover algorithm given target, false, and - element.
Let validity be the result of running check popover validity + given target, false, and null. If this throws an exception, catch it, and let + validity be false.
If validity is true, then run the show popover + algorithm given target, false, and element.
Otherwise:
-Otherwise, if the result of running check popover validity given - target, true, false, and null is true, then run the - hide popover algorithm given target, true, - true, false, and element.
Let validity be the result of running check popover + validity given target, true, and null. If this throws an exception, catch + it, and let validity be false.
If validity is true, then run the hide popover algorithm + given target, true, true, false, and element.
If the result of running check popover validity given target, - false, false, and null is true, then run the show popover algorithm given target, false, and - element.
Let validity be the result of running check popover validity + given target, false, and null. If this throws an exception, catch it, and let + validity be false.
If validity is true, then run the show popover + algorithm given target, false, and element.
Set document's showing popover to true.
If the result of running check popover validity given element, - false, throwExceptions, and null is false, then return.
Let validityResult be the result of running check popover validity + given element, false, and null. If this throws an exception, catch it, and let + validityResult be false.
If validityResult is false, then return.
Assert: element's popover trigger is null.
If the result of running check popover validity given element, false, - throwExceptions, and document is false, then run - cleanupShowingSteps and return.
+Set validityResult to the result of running check popover validity given + element, false, and document. If this throws an exception, catch it, and set validityResult to that exception.
Check popover validity is called again because firing the beforetoggle event could have disconnected this element or
changed its popover attribute.
If validityResult is not true:
+ +Run cleanupShowingSteps.
If throwExceptions is true and validityResult is a {{DOMException}}, then throw validityResult.
Otherwise, return.
Let shouldRestoreFocus be false.
Let originalType be the current state of element's DragEventInit : MouseEventInit {
data-x="attr-popover">popover attribute, then:
Run cleanupShowingSteps.
If throwExceptions is true, then throw an
"InvalidStateError" DOMException.
If the result of running check popover validity given element, - false, throwExceptions, and document is false, then run - cleanupShowingSteps and return.
+Set validityResult to the result of running check popover validity + given element, false, and document. If this throws an exception, catch + it, and set validityResult to that exception.
Check popover validity is called again because running hide popover stack until above could have fired the
beforetoggle event, and an event handler could have
@@ -91348,6 +91375,19 @@ dictionary DragEventInit : MouseEventInit {
attribute.
If validityResult is not true:
+ +Run cleanupShowingSteps.
If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.
Otherwise, return.
If the result of running topmost auto or hint popover on document is null, then set shouldRestoreFocus to @@ -91493,8 +91533,20 @@ dictionary DragEventInit : MouseEventInit { elements">HTML element or null source:
If the result of running check popover validity given element, - true, throwExceptions, and null is false, then return.
Let validityResult be the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and let + validityResult be that exception.
If validityResult is not true:
+ +If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.
Otherwise, return.
Let document be element's node document.
If autoPopoverListContainsElement is true, then hide popover stack until given document, element, Auto, focusPreviousElement, and fireEvents.
If the result of running check popover validity given element, - true, throwExceptions, and null is false, then run cleanupSteps and - return.
+Set validityResult to the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and set + validityResult to that exception.
Check popover validity is called again because running hide popover stack until could have disconnected
element or changed its popover attribute.
If validityResult is not true:
+ +Run cleanupSteps.
If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.
Otherwise, return.
If the result of running check popover validity given element, - true, throwExceptions, and null is false, then run cleanupSteps and - return.
+Set validityResult to the result of running check popover validity + given element, true, and null. If this throws an exception, catch it, and set + validityResult to that exception.
Check popover validity is called again because firing the beforetoggle event could have disconnected
element or changed its popover attribute.
If validityResult is not true:
+ +Run cleanupSteps.
If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.
Otherwise, return.
Request an element to be removed from the top layer given element.
Run check popover validity given expectedToBeShowing, true, and - null.
Run check popover validity given this, + expectedToBeShowing, and null.
To check popover validity for an HTML element
- element given a boolean expectedToBeShowing, a boolean
- throwExceptions, and a Document or null expectedDocument,
- perform the following steps. They throw an exception or return a boolean.
Document or
+ null expectedDocument, perform the following steps. They throw an exception or return
+ a boolean.
If element's popover attribute is in the No Popover state, then:
If throwExceptions is true, then throw a
- "NotSupportedError" DOMException.
Return false.
NotSupportedError" DOMException.
element's fullscreen flag is set,
then:
- -If throwExceptions is true, then throw an
- "InvalidStateError" DOMException.
Return false.
then throw an "InvalidStateError" DOMException.
Return true.
Otherwise, if popover's popover visibility state is hidden and the result of running check popover - validity given popover, false, false, and null is true, then run show - popover given popover, false, and node.
Otherwise:
+ +Let validity be the result of running check popover validity + given popover, false, and null. If this throws an exception, catch it, and let + validity be false.
If validity is true, then run show popover given + popover, false, and node.
Let validity be the result of running check popover validity given target, true, and null. If this throws an exception, catch it, and let validity be false.
Let validity be the result of running check popover validity + given target, true, and null. If this throws an exception, catch it, and let + validity be false.
If validity is true, then run the hide popover algorithm given target, true, true, false, and element.
If validity is true, then run the hide popover algorithm given + target, true, true, false, and element.
Otherwise:
Let validity be the result of running check popover - validity given target, true, and null. If this throws an exception, catch - it, and let validity be false.
Let validity be the result of running check popover validity + given target, true, and null. If this throws an exception, catch it, and let + validity be false.
If validity is true, then run the hide popover algorithm given target, true, true, false, and element.
Let hideUntil be the result of running topmost popover ancestor given this, null, and false.
Run hide popovers until given document, hideUntil, false, and true.
Run hide popovers until given document, hideUntil, + false, and true.
Run the dialog focusing steps given this.
Let hideUntil be the result of running topmost popover ancestor given subject, null, and false.
Run hide popovers until given document, hideUntil, false, and true.
Run hide popovers until given document, hideUntil, + false, and true.
Run the dialog focusing steps given subject.
Every HTML element has a popover trigger, which is an HTML element or null, initially set to null.
-Every HTML element has a popover hiding, which is a boolean, initially set to false.
+Every HTML element has a popover hiding, which + is a boolean, initially set to false.
Every HTML element popover toggle task tracker, which is a toggle task tracker or null, initially null.
@@ -91184,9 +91190,11 @@ dictionary DragEventInit : MouseEventInit { mode, which is "auto", "hint", or null,
initially null.
- Every Document has a hiding popover nesting count, which is a number, initially 0.
Every Document has a hiding popover nesting count, which is a number,
+ initially 0.
Every Document has a showing popover, which is a boolean, initially false.
Every Document has a showing popover, which is a boolean, initially
+ false.
The following attribute change
@@ -91253,11 +91261,12 @@ dictionary DragEventInit : MouseEventInit {
Let document be element's node document. If document's showing popover is true, or document's hiding popover nesting count is not 0, then: If document's showing popover is true, or document's
+ hiding popover nesting count is not 0, then: If throwExceptions is true, then throw a " If throwExceptions is true, then throw a
+ " Return.
-
@@ -91296,8 +91305,9 @@ dictionary DragEventInit : MouseEventInit {
element is false, then run cleanupShowingSteps and return.InvalidStateError"
- DOMException.InvalidStateError" DOMException.
Set validityResult to the result of running check popover validity given - element, false, and document. If this throws an exception, catch it, and set validityResult to that exception.
+Set validityResult to the result of running check popover validity + given element, false, and document. If this throws an exception, catch it, + and set validityResult to that exception.
Check popover validity is called again because firing the beforetoggle event could have disconnected this element or
@@ -91310,7 +91320,8 @@ dictionary DragEventInit : MouseEventInit {
Run cleanupShowingSteps.
If throwExceptions is true and validityResult is a {{DOMException}}, then throw validityResult.
If throwExceptions is true and validityResult is a + {{DOMException}}, then throw validityResult.
Otherwise, return.
Let originalType be the current state of element's popover attribute.
Let ancestor be the result of running the topmost popover ancestor algorithm given element, source, and true.
Let ancestor be the result of running the topmost popover ancestor + algorithm given element, source, and true.
Let effectiveType be originalType.
ancestor is not null;
ancestor's opened in popover mode is "hint"; and
ancestor's opened in popover mode is "hint"; and
effectiveType is the Auto state,
effectiveType is the Auto + state,
then set effectiveType to the Hint state.
+then set effectiveType to the Hint + state.
-Hint popovers are lower priority than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. To resolve this case, the effectiveType is 'downgraded' to Hint.
+Hint popovers are lower priority + than Auto popovers, so an Auto popover cannot have a Hint popover as a 'parent'. To resolve this case, the + effectiveType is 'downgraded' to Hint.
-If effectiveType is the Auto or Hint state, then run hide popover stack until given document, ancestor, Hint, shouldRestoreFocus, and true.
If effectiveType is the Auto or + Hint state, then run hide popover stack + until given document, ancestor, Hint, shouldRestoreFocus, and true.
If effectiveType is the Auto state, then run hide popover stack until given document, ancestor, Auto, shouldRestoreFocus, and true.
If effectiveType is the Auto + state, then run hide popover stack until given document, + ancestor, Auto, + shouldRestoreFocus, and true.
If effectiveType is Auto or DragEventInit : MouseEventInit { given element, false, and document. If this throws an exception, catch it, and set validityResult to that exception.
-Check popover validity is called again because running hide popover stack until above could have fired the
- beforetoggle event, and an event handler could have
+
Check popover validity is called again because running hide
+ popover stack until above could have fired the beforetoggle event, and an event handler could have
disconnected this element or changed its popover
attribute.
If the result of running topmost auto or hint - popover on document is null, then set shouldRestoreFocus to - true.
+If the result of running topmost auto or hint popover on document + is null, then set shouldRestoreFocus to true.
This ensures that focus is returned to the previously-focused element only for the first popover in a stack.
@@ -91411,7 +91437,8 @@ dictionary DragEventInit : MouseEventInit {Otherwise:
Assert: effectiveType is Hint.
Assert: effectiveType is Hint.
Assert: document's showing hint popover list does not contain element.
Add an element to the top layer given element.
If effectiveType is Hint and ancestor's opened in popover mode is "auto", then set document's hint stack parent to ancestor.
If effectiveType is Hint and
+ ancestor's opened in popover mode is "auto", then
+ set document's hint stack parent to ancestor.
Set element's popover visibility state to showing.
Let cleanupSteps be the following steps:
If nestedHide is false, then set element's popover hiding to false.
If nestedHide is false, then set element's popover + hiding to false.
If element's popover close watcher is not null, then:
@@ -91579,32 +91609,47 @@ dictionary DragEventInit : MouseEventInit {Let autoPopoverListContainsElement be true if document's showing auto popover list contains element; otherwise false.
Let autoPopoverListContainsElement be true if document's + showing auto popover list contains + element; otherwise false.
Let hintPopoverListContainsElement be true if document's showing hint popover list contains element; otherwise false.
Let hintPopoverListContainsElement be true if document's + showing hint popover list contains + element; otherwise false.
If element's opened in popover mode is "auto"
or "hint", then:
If hintPopoverListContainsElement is true, then hide popover stack until given document, element, Hint, focusPreviousElement, and fireEvents.
If hintPopoverListContainsElement is true, then hide popover stack + until given document, element, Hint, focusPreviousElement, and + fireEvents.
If element is document's hint stack parent, then hide popover stack until given document, null, Hint, focusPreviousElement, and fireEvents.
+If element is document's hint stack parent, then + hide popover stack until given document, null, Hint, focusPreviousElement, and + fireEvents.
-If the document's hint stack parent is to hide, then all hint popovers are hidden.
+If the document's hint stack parent is to hide, then + all hint popovers are hidden.
If autoPopoverListContainsElement is true, then hide popover stack until given document, element, Auto, focusPreviousElement, and fireEvents.
If autoPopoverListContainsElement is true, then hide popover stack + until given document, element, Auto, focusPreviousElement, and + fireEvents.
Set validityResult to the result of running check popover validity given element, true, and null. If this throws an exception, catch it, and set validityResult to that exception.
-Check popover validity is called again because running hide popover stack until could have disconnected
- element or changed its popover attribute.
Check popover validity is called again because running hide
+ popover stack until could have disconnected element or changed its popover attribute.
Set element's popover visibility state to hidden.
If element is document's hint stack parent, or document's showing hint popover list is empty, then set document's hint stack parent to null.
If element is document's hint stack parent, or + document's showing hint popover list is empty, then set document's hint stack parent to + null.
If fireEvents is true, then queue a popover toggle event task
given element, "open", "closed", and
@@ -91746,87 +91794,118 @@ dictionary DragEventInit : MouseEventInit {
To hide popovers until, given a Document document, an HTML element or null endpoint, a boolean focusPreviousElement, and a boolean fireEvents:
To hide popovers until, given a Document document, an HTML element or null endpoint, a boolean
+ focusPreviousElement, and a boolean fireEvents:
Let endpointIsHint be true if document's showing hint popover list contains endpoint; otherwise false.
Let endpointIsHint be true if document's showing hint popover + list contains endpoint; otherwise + false.
Run hide popover stack until given document, endpoint, Hint, focusPreviousElement, and fireEvents.
Run hide popover stack until given document, endpoint, + Hint, focusPreviousElement, and + fireEvents.
If endpointIsHint, then return.
Run hide popover stack until given document, endpoint, Auto, focusPreviousElement, and fireEvents.
Run hide popover stack until given document, endpoint, + Auto, focusPreviousElement, and + fireEvents.
To hide popover stack until, given a Document document, an HTML element or null endpoint, an Auto or Hint stackType, a boolean focusPreviousElement, and a boolean fireEvents:
To hide popover stack until, given a Document document, an
+ HTML element or null endpoint, an Auto or Hint
+ stackType, a boolean focusPreviousElement, and a boolean
+ fireEvents:
Let popoverList be document's showing auto popover list if stackType is Auto; otherwise document's showing hint popover list.
Let popoverList be document's showing auto popover list + if stackType is Auto; otherwise + document's showing hint popover list.
Let lastHideIndex be 0 if popoverList does not contain endpoint; otherwise the index of endpoint in popoverList plus 1.
Let lastHideIndex be 0 if popoverList does not contain endpoint; otherwise the index of endpoint in + popoverList plus 1.
Let toHide be a slice of popoverList from lastHideIndex, in reverse order.
Let toHide be a slice of + popoverList from lastHideIndex, in + reverse order.
Let toRemain be a slice of popoverList from 0 to lastHideIndex.
Let toRemain be a slice of + popoverList from 0 to lastHideIndex.
For each popover of toHide: run the hide popover algorithm given popover, focusPreviousElement, fireEvents, false, and null.
For each popover of toHide: run + the hide popover algorithm given popover, + focusPreviousElement, fireEvents, false, and null.
Let newPopoverList be document's showing auto popover list if stackType is Auto; otherwise document's showing hint popover list.
Let newPopoverList be document's showing auto popover + list if stackType is Auto; + otherwise document's showing hint popover list.
Reverse newPopoverList.
For each popover in newPopoverList:
+For each popover in + newPopoverList:
If toRemain contains popover, then continue.
If toRemain contains popover, + then continue.
Run the hide popover algorithm given popover, focusPreviousElement, false, false, and null.
+Run the hide popover algorithm given popover, + focusPreviousElement, false, false, and null.
-This happens if popovers are shown whilst hiding popovers. For example, in beforetoggle events. This is usually a developer error, so user agents are encouraged to show a warning. In this additional hiding phase, fireEvents is ignored, and false is used instead.
This happens if popovers are shown whilst hiding popovers. For example, in
+ beforetoggle events. This is usually a developer
+ error, so user agents are encouraged to show a warning. In this additional hiding phase,
+ fireEvents is ignored, and false is used instead.
The hide popover stack until - algorithm is used in several cases to hide all popovers that don't stay open when something - happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only - the popovers that aren't related to the node clicked by the user.
+The hide popover stack until algorithm is used in several cases to + hide all popovers that don't stay open when something happens. For example, during light-dismiss + of a popover, this algorithm ensures that we close only the popovers that aren't related to the + node clicked by the user.
To find the topmost popover ancestor, given a Node
- newPopoverOrTopLayerElement, an HTML element or null source, and a boolean
- isPopover, perform the following steps. They return an HTML element or null.
The topmost popover ancestor algorithm will return the topmost ancestor popover for the provided popover or top layer - element. Popovers can be related to each other in several ways, creating a tree of popovers. - There are two paths through which one popover (call it the "child" popover) can have a topmost - ancestor popover (call it the "parent" popover):
+The topmost popover ancestor algorithm will return the topmost ancestor popover + for the provided popover or top layer element. Popovers can be related to each other in several + ways, creating a tree of popovers. There are two paths through which one popover (call it the + "child" popover) can have a topmost ancestor popover (call it the "parent" popover):
The popovers are nested within each other in the node tree. In this case, the descendant popover is the "child" and its topmost ancestor popover is the "parent".
An element is the 'source' of the popover (e.g., a button with command in the Show Popover state). In this case,
- the popover is the "child", and the popover subtree the trigger element is in is the
- "parent". The trigger element has to be in a popover and reference an open popover.
An element is the 'source' of the popover (e.g., a button with command in the Show Popover state). In this case, the
+ popover is the "child", and the popover subtree the trigger element is in is the "parent". The
+ trigger element has to be in a popover and reference an open popover.
In each of the relationships formed above, the parent popover has to be strictly earlier in - the showing auto popover list or showing hint popover list than the child popover, or it does not form a valid - ancestral relationship. This eliminates non-showing popovers and self-pointers (e.g., a popover - containing an invoking element that points back to the containing popover), and it allows for the - construction of a well-formed tree from the (possibly cyclic) graph of connections. Only Auto and Hint popovers are considered.
+ the showing auto popover list or showing hint popover list than the + child popover, or it does not form a valid ancestral relationship. This eliminates non-showing + popovers and self-pointers (e.g., a popover containing an invoking element that points back to + the containing popover), and it allows for the construction of a well-formed tree from the + (possibly cyclic) graph of connections. Only Auto + and Hint popovers are considered.If the provided element is a top layer element such as a dialog which is not
showing as a popover, then topmost popover ancestor will only look in the node tree
@@ -91860,17 +91939,26 @@ dictionary DragEventInit : MouseEventInit {
-
Let document be newPopoverOrTopLayerElement's node document.
Let document be newPopoverOrTopLayerElement's node + document.
Let combinedPopovers be document's showing auto popover list extended with document's showing hint popover list.
Let combinedPopovers be document's showing auto popover + list extended with document's showing + hint popover list.
Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement is a flat tree descendant, otherwise -1.
Let popoverAncestorIndex be the index of the last item in combinedPopovers of which newPopoverOrTopLayerElement + is a flat tree descendant, otherwise -1.
Let sourceAncestorIndex be -1.
If source is not null, then set sourceAncestorIndex to the index of the last item in combinedPopovers of which source is a flat tree descendant, otherwise -1.
If source is not null, then set sourceAncestorIndex to the index of + the last item in combinedPopovers of which + source is a flat tree descendant, + otherwise -1.
Let ancestorIndex be the maximum of popoverAncestorIndex and sourceAncestorIndex.
Let ancestorIndex be the maximum of popoverAncestorIndex and + sourceAncestorIndex.
If ancestorIndex is -1, then return null.
While currentNode is not null:
If currentNode's opened in popover mode is "auto" or "hint", and currentNode's popover visibility state is showing, then return currentNode.
If currentNode's opened in popover mode is "auto" or "hint", and currentNode's
+ popover visibility state is showing,
+ then return currentNode.
Set currentNode to currentNode's parent in the flat tree.
To find the topmost auto or hint popover given a
- Document document, perform the following steps. They return an To find the topmost auto or hint popover given
+ a Document document, perform the following steps. They return an HTML element or null.
To check popover validity for an HTML element
element given a boolean expectedToBeShowing and a Document or
- null expectedDocument, perform the following steps. They throw an exception or return
- a boolean.
Each Document has a hint stack parent, which is an
- HTML element or null, initially null.
Each Document has a hint stack parent, which is an HTML element or null, initially null.
The hint stack parent tracks which item in the showing auto popover list is the 'parent' of the first item in the showing hint popover list, or null if the first item in showing hint popover list is not 'child' to an item in the showing auto popover list.
+The hint stack parent tracks which item in the showing auto popover + list is the 'parent' of the first item in the showing hint popover list, or + null if the first item in showing hint popover list is not 'child' to an item in the + showing auto popover list.
-Therefore, when the hint stack parent is not null, it will have an opened in popover mode of "auto".
Therefore, when the hint stack parent is not null, it will have an opened
+ in popover mode of "auto".
"Light dismiss" means that clicking outside of a popover whose popover attribute is in the Auto or Hint state will close the popover. This is in addition to
- how such popovers respond to close requests.
To light dismiss open popovers, given a PointerEvent
@@ -92271,7 +92367,8 @@ dictionary DragEventInit : MouseEventInit {
Let document be target's node document.
If the result of running topmost auto or hint popover given document is null, then return.
If the result of running topmost auto or hint popover given + document is null, then return.
If event's If sameTarget is false, then return Let endpointIsHint be true if document's showing hint popover list contains ancestor; otherwise false. Let endpointIsHint be true if document's showing hint
+ popover list contains ancestor; otherwise
+ false. Run hide popover stack until given document, ancestor, Hint, false, and true. Run hide popover stack until given document,
+ ancestor, Hint, false, and
+ true. Let autoEndpoint be ancestor. If endpointIsHint, then set autoEndpoint to document's hint stack parent. If endpointIsHint, then set autoEndpoint to document's
+ hint stack parent. This means, if a hint popover is clicked, auto popovers are closed, except those that are parent to the clicked hint popover. This means, if a hint popover is clicked, auto popovers are closed, except
+ those that are parent to the clicked hint popover. Run hide popover stack until given document, autoEndpoint, Auto, false, and true. Run hide popover stack until given document,
+ autoEndpoint, Auto, false, and
+ true.type is "pointerdown", then: set document's popover
@@ -92293,19 +92390,27 @@ dictionary DragEventInit : MouseEventInit {