From 125bcf3398213ed8cd7134e70b5238d45bc69422 Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Thu, 11 Jan 2024 18:21:14 -0800 Subject: [PATCH] Update popover=hint behavior to allow a stack of hints The previous implementation only allowed one popover=hint to be open at a time. Per conversation at [1], developers feel that it should be possible to nest popover=hint popovers. This CL implements that capability. There are now two popover stacks in Document: PopoverAutoStack and PopoverHintStack. Since it is possible to nest hints within autos, the PopoverAutoStack can contain hints. However, there are a few constraints: - The PopoverHintStack only ever contains hints. - Once the PopoverAutoStack contains a hint, all subsequent popovers in the stack must also be hints. - A popover=hint can never be the ancestor of a popover=auto. The light dismiss behavior is roughly the same as before, with a slight tweak that simplifies behavior: closing anything in the PopoverAutoStack will always close everything in the PopoverHintStack. That was not the case before, but it was a bit of a weird corner case. Note that I found a crasher (happens in stable, with just auto popovers) that I added a test for here. The bug for that is crbug.com/1513282. I'll fix that in a followup. [1] https://github.com/whatwg/html/issues/9776#issuecomment-1785814179 Bug: 1416284,1513282 Change-Id: Ic064ecf1377bb8abfc812654c85016e6d1cbbdaf --- .../popover-light-dismiss-hint.tentative.html | 107 +++++++++++++ .../popovers/popover-light-dismiss.html | 46 ------ .../popovers/popover-open-in-event-crash.html | 20 +++ .../popover-types-with-hints.tentative.html | 141 +++++++++--------- 4 files changed, 195 insertions(+), 119 deletions(-) create mode 100644 html/semantics/popovers/popover-light-dismiss-hint.tentative.html create mode 100644 html/semantics/popovers/popover-open-in-event-crash.html diff --git a/html/semantics/popovers/popover-light-dismiss-hint.tentative.html b/html/semantics/popovers/popover-light-dismiss-hint.tentative.html new file mode 100644 index 00000000000000..f07363115fba68 --- /dev/null +++ b/html/semantics/popovers/popover-light-dismiss-hint.tentative.html @@ -0,0 +1,107 @@ + + +Popover light dismiss behavior for hints + + + + + + + + + + +
+
auto 1 +
auto 2 +
inner hint 1 +
inner hint 2 +
Improperly nested auto 1
+
+
+
+
+
hint 1 +
hint 2 +
Improperly nested auto 2
+
+
+
Manual
+ + + + diff --git a/html/semantics/popovers/popover-light-dismiss.html b/html/semantics/popovers/popover-light-dismiss.html index 4a57276bce3cbb..0c51693aa120a7 100644 --- a/html/semantics/popovers/popover-light-dismiss.html +++ b/html/semantics/popovers/popover-light-dismiss.html @@ -449,52 +449,6 @@ },'Ensure circular/convoluted ancestral relationships are functional, with a direct showPopover()'); -
Popover
-
Hint
-
Manual
- -
Popover 1
Popover 2
Popover 3
diff --git a/html/semantics/popovers/popover-open-in-event-crash.html b/html/semantics/popovers/popover-open-in-event-crash.html new file mode 100644 index 00000000000000..0a862388d516a3 --- /dev/null +++ b/html/semantics/popovers/popover-open-in-event-crash.html @@ -0,0 +1,20 @@ + + + + + +
Popover 1 +
Popover 2
+
+ diff --git a/html/semantics/popovers/popover-types-with-hints.tentative.html b/html/semantics/popovers/popover-types-with-hints.tentative.html index 7a73efb50fc8e5..07f0e26fce71b9 100644 --- a/html/semantics/popovers/popover-types-with-hints.tentative.html +++ b/html/semantics/popovers/popover-types-with-hints.tentative.html @@ -5,6 +5,22 @@ + +
Popover
Hint
@@ -12,55 +28,49 @@
Async
@@ -76,26 +86,20 @@
Hint anchored to popover
@@ -107,16 +111,15 @@
@@ -126,15 +129,14 @@
@@ -146,20 +148,16 @@ @@ -169,16 +167,13 @@
Non-Nested hint