From f592757f5b4c014312ab23915f18eb39e756eaa5 Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Fri, 31 Mar 2023 13:16:03 -0700 Subject: [PATCH] Convert `:open` to `:popover-open` for popovers See [1]/[2] for more context, but there are cases where `:open` is ambiguous for popovers. If multiple elements support `:open/:closed`, and [popover] can be applied to any of them, there are situations where an element is both open and closed. For example, `
` can be closed as a details element and open as a popover, which makes it match both `:open` and `:closed`. It seems that really `:open` and `:closed` should match *elements* that can open and close, and not things that can be made to open or close via an attribute or other mechanism such as JS. This CL adds `:popover-open` which only applies to popovers in the open state, and it removes `:open` and `:closed` support for popovers. It also converts all of the popover WPTs to use `:popover-open` instead of either `:open` or `:closed`. [1] https://github.com/w3c/csswg-drafts/issues/8637 [2] https://github.com/whatwg/html/pull/9077 Bug: 1307772 Fixed: 1429670 Change-Id: I8d840512166ccdb5d5c8abbb7192bbce7177ee88 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4373888 Reviewed-by: Joey Arhar Auto-Submit: Mason Freed Commit-Queue: Mason Freed Cr-Commit-Position: refs/heads/main@{#1124869} --- .../selectmenu-parts-structure.tentative.html | 10 +- ...popover-position-with-zoom.tentative.html} | 0 ...electmenu-popover-position.tentative.html} | 0 ...html => selectmenu-popover.tentative.html} | 0 .../hide-other-popover-side-effects.html | 2 +- .../light-dismiss-event-ordering.html | 6 +- .../popovers/popover-anchor-nesting.html | 8 +- .../popovers/popover-attribute-basic.html | 67 +++-- .../popovers/popover-document-open.html | 8 +- html/semantics/popovers/popover-events.html | 46 ++-- html/semantics/popovers/popover-focus-2.html | 14 +- .../popovers/popover-focus-child-dialog.html | 6 +- html/semantics/popovers/popover-focus.html | 34 +-- .../popovers/popover-hidden-display.html | 4 +- .../popovers/popover-inside-display-none.html | 2 +- .../popovers/popover-invoking-attribute.html | 16 +- .../popover-light-dismiss-on-scroll.html | 2 +- .../popovers/popover-light-dismiss.html | 236 +++++++++--------- .../popover-not-keyboard-focusable.html | 8 +- .../semantics/popovers/popover-removal-2.html | 8 +- html/semantics/popovers/popover-removal.html | 4 +- .../popovers/popover-shadow-dom.html | 34 +-- html/semantics/popovers/popover-stacking.html | 14 +- .../popover-target-element-disabled.html | 64 ++--- .../popover-top-layer-combinations.html | 15 +- .../popover-top-layer-interactions.html | 2 +- .../popover-types-with-hints.tentative.html | 54 ++-- html/semantics/popovers/popover-types.html | 6 +- .../popovers/resources/popover-utils.js | 8 +- 29 files changed, 342 insertions(+), 336 deletions(-) rename html/semantics/forms/the-selectmenu-element/{selectmenu-popup-position-with-zoom.tentative.html => selectmenu-popover-position-with-zoom.tentative.html} (100%) rename html/semantics/forms/the-selectmenu-element/{selectmenu-popup-position.tentative.html => selectmenu-popover-position.tentative.html} (100%) rename html/semantics/forms/the-selectmenu-element/{selectmenu-popup.tentative.html => selectmenu-popover.tentative.html} (100%) diff --git a/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html b/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html index 4f49d3f0ea9354..08c283322d54a3 100644 --- a/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html +++ b/html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html @@ -208,13 +208,13 @@ const selectMenu1Popover = document.getElementById("selectMenu1-popover"); const selectMenu1Button = document.getElementById("selectMenu1-button"); const selectMenu1Child2 = document.getElementById("selectMenu1-child2"); - assert_false(selectMenu1Popover.matches(':open')); + assert_false(selectMenu1Popover.matches(':popover-open')); selectMenu1Button.click(); - assert_false(selectMenu1Popover.matches(':open'), "Clicking a button part that is a descendant of the listbox part should have no effect"); + assert_false(selectMenu1Popover.matches(':popover-open'), "Clicking a button part that is a descendant of the listbox part should have no effect"); assert_equals(selectMenu1.value, "one"); await clickOn(selectMenu1); - assert_true(selectMenu1Popover.matches(':open')); + assert_true(selectMenu1Popover.matches(':popover-open')); await clickOn(selectMenu1Child2); assert_equals(selectMenu1.value, "two", "Clicking an