You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf48cdc
Browse filesBrowse the repository at this point in the historyBrowse files
See this discussion for more context:
whatwg/html#12304whatwg/html#12345
This CL implements a simplified behavioral model for popover=hint and
popover=auto, cleanly separating the autoRootedPopoverStack from the
hintRootedPopoverStack and introducing a `hintStackParent` to track
where the hint stack branches off the auto stack.
The new behavior resolves the following inconsistencies (gated behind
the `PopoverHintNewBehavior` experimental runtime flag):
1. Opening a hint popover will not hide unrelated auto popovers.
2. Opening a hint popover closes only other non-ancestor hint
popovers.
3. Clicking outside consistently closes both auto and hint popovers.
4. Hiding an auto popover closes only its child popovers.
5. Opening an auto popover inside a hint popover is disallowed and
will fail.
A new WPT test (`popover-hint-hierarchy.html`) is added to explicitly
assert these 5 rules, and existing popover WPTs are updated to reflect
the new behavior. A virtual test suite (`popover-hint-old-behavior`)
is also added to continue testing the legacy behavior. I'm not sure
how to best handle the changed tests (and I guess the new test too)
in the context of a spec PR that is forthcoming. I'd like to be able
to publish (as a WPT PR at least) the changes, to help with the PR
effort. Suggestions appreciated.
A note about the diff: I made all of the feature flag checks look like
`if (!feature enabled) {` in the hopes that the old code would show
as unchanged in the diff, but gerrit's diff algorithm isn't great.
It's at least a little better like this than if I put the new code
first, so I left it.
Bug: 4990199
Change-Id: I41d8d96be71ba60ec5e7aa640c935258d1e33431
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7727959
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1615186}
Copy file name to clipboardExpand all lines: html/semantics/popovers/popover-types-with-hints.html
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@
50
50
hint.showPopover();
51
51
assertState([true,true,true,true]);
52
52
auto.hidePopover();
53
-
assertState([false,false,true,true]);
53
+
assertState([false,true,true,true]);
54
54
hint.hidePopover();
55
55
manual.hidePopover();
56
56
assertState([false,false,false,true]);
@@ -104,9 +104,11 @@
104
104
constauto=getPopovers()[1];
105
105
hint.showPopover();
106
106
assertState([true,false]);
107
-
auto.showPopover();
108
-
assertState([false,true]);
109
-
auto.hidePopover();
107
+
assert_throws_dom('InvalidStateError',()=>{
108
+
auto.showPopover();
109
+
});
110
+
assertState([true,false]);
111
+
hint.hidePopover();
110
112
assertState([false,false]);
111
113
},'If a popover=auto is shown, it should hide any open popover=hint, including if the popover=hint is an ancestral popover of the popover=auto. (You can\'t nest a popover=auto inside a popover=hint)');
112
114
</script>
@@ -125,8 +127,8 @@
125
127
auto.showPopover();
126
128
auto2.showPopover();
127
129
assertState([true,true,false]);
128
-
hint.showPopover();// This should hide auto2, since it is nested in auto1.
129
-
assertState([true,false,true]);
130
+
hint.showPopover();// This should NOT hide auto2, since hint doesn't close unrelated autos.
131
+
assertState([true,true,true]);
130
132
auto.hidePopover();// Should hide both auto and hint.
131
133
assertState([false,false,false]);
132
134
},'If you: a) show a popover=auto (call it D), then b) show a descendent popover=hint of D (call it T), then c) hide D, then T should be hidden. (A popover=hint can be nested inside a popover=auto)');
@@ -144,6 +146,8 @@
144
146
hint.showPopover();
145
147
assertState([true,true]);
146
148
auto.hidePopover();
149
+
assertState([false,true]);
150
+
hint.hidePopover();
147
151
assertState([false,false]);
148
152
},'If you: a) show a popover=auto (call it D), then b) show a non-descendent popover=hint of D (call it T), then c) hide D, then T should be hidden. (Non-nested popover=hint gets hidden when unrelated popover=autos are hidden)');
0 commit comments