Skip to content

Commit 4f944e3

Browse files
mfreed7chromium-wpt-export-bot
authored andcommitted
Rename :popup-open pseudo class to :top-layer
This CL just does a rename for the :top-layer pseudo class. It does not change behavior, which is/was that this pseudo class only applies to elements using the Popup API [1], and not to all elements that might inhabit the top layer. That will need to wait for a CSSWG resolution. But for now, the [2] resolution means we should use this pseudo class for the Popup API prototype starting now. [1] https://open-ui.org/components/popup.research.explainer [2] openui/open-ui#470 (comment) Bug: 1307772 Change-Id: I81a89132b84346a360d7b580f5f39be9da697bdc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3668918 Commit-Queue: Dan Clark Auto-Submit: Mason Freed Reviewed-by: Dan Clark Cr-Commit-Position: refs/heads/main@{#1008430}
1 parent 113fc44 commit 4f944e3

18 files changed

+199
-199
lines changed

html/semantics/forms/the-selectmenu-element/selectmenu-parts-structure.tentative.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@
208208
const selectMenu1Popup = document.getElementById("selectMenu1-popup");
209209
const selectMenu1Button = document.getElementById("selectMenu1-button");
210210
const selectMenu1Child2 = document.getElementById("selectMenu1-child2");
211-
assert_false(selectMenu1Popup.matches(':popup-open'));
211+
assert_false(selectMenu1Popup.matches(':top-layer'));
212212
selectMenu1Button.click();
213-
assert_false(selectMenu1Popup.matches(':popup-open'), "Clicking a button part that is a descendant of the listbox part should have no effect");
213+
assert_false(selectMenu1Popup.matches(':top-layer'), "Clicking a button part that is a descendant of the listbox part should have no effect");
214214

215215
assert_equals(selectMenu1.value, "one");
216216
await clickOn(selectMenu1);
217-
assert_true(selectMenu1Popup.matches(':popup-open'));
217+
assert_true(selectMenu1Popup.matches(':top-layer'));
218218
await clickOn(selectMenu1Child2);
219219
assert_equals(selectMenu1.value, "two", "Clicking an );
220220
}, "To receive button part controller code, an element labeled as a button must not be a descendant of the listbox part in a flat tree traversal");
@@ -226,9 +226,9 @@
226226
const selectMenu2Child2 = document.getElementById("selectMenu2-child2");
227227
const selectMenu2Child4 = document.getElementById("selectMenu2-child4");
228228

229-
assert_false(selectMenu2Popup.matches(':popup-open'));
229+
assert_false(selectMenu2Popup.matches(':top-layer'));
230230
await clickOn(selectMenu2Button);
231-
assert_false(selectMenu2Popup.matches(':popup-open'), "Clicking a button part should not show an invalid listbox part");
231+
assert_false(selectMenu2Popup.matches(':top-layer'), "Clicking a button part should not show an invalid listbox part");
232232

233233
assert_equals(selectMenu2.value, "three");
234234
await clickOn(selectMenu2Button);

html/semantics/popups/popup-anchor-nesting.tentative.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@
4646
setup({ explicit_done: true });
4747

4848
popup2.showPopup();
49-
assert_false(popup1.matches(':popup-open'));
50-
assert_true(popup2.matches(':popup-open'));
49+
assert_false(popup1.matches(':top-layer'));
50+
assert_true(popup2.matches(':top-layer'));
5151
await clickOn(button1);
5252
test(t => {
5353
// Button1 is the anchor for popup1, and an ancestor of popup2.
5454
// Since popup2 is open, but not popup1, button1 should not be
5555
// the anchor of any open popup. So popup2 should be closed.
56-
assert_false(popup2.matches(':popup-open'));
57-
assert_true(popup1.matches(':popup-open'));
56+
assert_false(popup2.matches(':top-layer'));
57+
assert_true(popup1.matches(':top-layer'));
5858
},'Nested popups (inside anchor elements) do not affect light dismiss');
5959

6060
done();

html/semantics/popups/popup-attribute-basic.tentative.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
const isVisible = !!(popup.offsetWidth || popup.offsetHeight || popup.getClientRects().length);
2323
if (isVisible) {
2424
assert_not_equals(window.getComputedStyle(popup).display,'none');
25-
assert_equals(isPopup,popup.matches(':popup-open'));
25+
assert_equals(isPopup,popup.matches(':top-layer'));
2626
} else {
2727
assert_equals(window.getComputedStyle(popup).display,'none');
28-
assert_false(popup.matches(':popup-open'));
28+
assert_false(popup.matches(':top-layer'));
2929
}
3030
return isVisible;
3131
}
@@ -138,17 +138,17 @@
138138
test(() => {
139139
const popup = createPopup();
140140
popup.showPopup();
141-
assert_true(popup.matches(':popup-open'));
141+
assert_true(popup.matches(':top-layer'));
142142
popup.setAttribute('popup','hint'); // Change popup type
143-
assert_false(popup.matches(':popup-open'));
143+
assert_false(popup.matches(':top-layer'));
144144
popup.showPopup();
145-
assert_true(popup.matches(':popup-open'));
145+
assert_true(popup.matches(':top-layer'));
146146
popup.setAttribute('popup','async');
147-
assert_false(popup.matches(':popup-open'));
147+
assert_false(popup.matches(':top-layer'));
148148
popup.showPopup();
149-
assert_true(popup.matches(':popup-open'));
149+
assert_true(popup.matches(':top-layer'));
150150
popup.setAttribute('popup','invalid');
151-
assert_false(popup.matches(':popup-open'));
151+
assert_false(popup.matches(':top-layer'));
152152
},'Changing attribute values should close open popups');
153153

154154

@@ -157,11 +157,11 @@
157157
const popup = createPopup();
158158
popup.setAttribute('popup',type);
159159
popup.showPopup();
160-
assert_true(popup.matches(':popup-open'));
160+
assert_true(popup.matches(':top-layer'));
161161
popup.remove();
162-
assert_false(popup.matches(':popup-open'));
162+
assert_false(popup.matches(':top-layer'));
163163
document.body.appendChild(popup);
164-
assert_false(popup.matches(':popup-open'));
164+
assert_false(popup.matches(':top-layer'));
165165
},`Removing a visible popup=${type} element from the document should close the popup`);
166166
});
167167
script>

html/semantics/popups/popup-defaultopen-2.tentative.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
requestAnimationFrame(() => {
1717
requestAnimationFrame(() => {
1818
test(function(){
19-
assert_true(p1.matches(':popup-open'),'The first (outermost) popup should be the one that opens in this case');
20-
assert_false(p2.matches(':popup-open'),'The inner popup should not be open');
19+
assert_true(p1.matches(':top-layer'),'The first (outermost) popup should be the one that opens in this case');
20+
assert_false(p2.matches(':top-layer'),'The inner popup should not be open');
2121
}, "The defaultopen attribute should cause only the first popup to open");
2222
});
2323
});

html/semantics/popups/popup-defaultopen.tentative.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
requestAnimationFrame(() => {
1919
requestAnimationFrame(() => {
2020
test(function(){
21-
assert_true(p1.matches(':popup-open'),'defaultopen should open the popup');
21+
assert_true(p1.matches(':top-layer'),'defaultopen should open the popup');
2222
assert_true(p1.hasAttribute('defaultopen'));
2323
assert_true(p1.defaultOpen,'defaultopen should be reflected in the IDL attribute');
24-
assert_false(p2.matches(':popup-open'), 'Only the first popup with defaultopen should be open on load');
24+
assert_false(p2.matches(':top-layer'), 'Only the first popup with defaultopen should be open on load');
2525
assert_true(p2.hasAttribute('defaultopen'),'defaultopen should be present/true, even if not opened');
2626
assert_true(p2.defaultOpen,'defaultopen should be present/true, even if not opened');
2727

28-
assert_false(p2b.matches(':popup-open'),'Only the first popup/hint with defaultopen should be open on load');
29-
assert_true(p4.matches(':popup-open'),'defaultopen should open all async popups');
30-
assert_true(p5.matches(':popup-open'),'defaultopen should open all async popups');
28+
assert_false(p2b.matches(':top-layer'),'Only the first popup/hint with defaultopen should be open on load');
29+
assert_true(p4.matches(':top-layer'),'defaultopen should open all async popups');
30+
assert_true(p5.matches(':top-layer'),'defaultopen should open all async popups');
3131

32-
assert_false(p3.matches(':popup-open'));
32+
assert_false(p3.matches(':top-layer'));
3333
p3.setAttribute('defaultopen','');
34-
assert_false(p3.matches(':popup-open'), 'Changing defaultopen should not affect open status');
34+
assert_false(p3.matches(':top-layer'), 'Changing defaultopen should not affect open status');
3535
assert_true(p3.hasAttribute('defaultopen'));
3636
assert_true(p3.defaultOpen,'defaultopen should still reflect to IDL');
3737

3838
p1.removeAttribute('defaultopen');
39-
assert_true(p1.matches(':popup-open'),'removing defaultopen should not close the popup');
39+
assert_true(p1.matches(':top-layer'),'removing defaultopen should not close the popup');
4040
assert_false(p1.hasAttribute('defaultopen'),'...but it should reflect to IDL');
4141

4242
p1.hidePopup();

html/semantics/popups/popup-events.tentative.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@
3131
let showCount = 0;
3232
let hideCount = 0;
3333
await new Promise(resolve => window.addEventListener('load',() => resolve()));
34-
assert_false(popup.matches(':popup-open'));
34+
assert_false(popup.matches(':top-layer'));
3535
document.addEventListener('show',() => ++showCount);
3636
document.addEventListener('hide',() => ++hideCount);
3737
assert_equals(0,showCount);
3838
assert_equals(0,hideCount);
3939
popup.showPopup();
40-
assert_true(popup.matches(':popup-open'));
40+
assert_true(popup.matches(':top-layer'));
4141
await waitUntilChange(() => showCount);
4242
assert_equals(1,showCount);
4343
assert_equals(0,hideCount);
4444
await requestAnimationFramePromise();
45-
assert_true(popup.matches(':popup-open'));
45+
assert_true(popup.matches(':top-layer'));
4646
popup.hidePopup();
47-
assert_false(popup.matches(':popup-open'));
47+
assert_false(popup.matches(':top-layer'));
4848
await waitUntilChange(() => hideCount);
4949
assert_equals(1,showCount);
5050
assert_equals(1,hideCount);
5151
await requestAnimationFramePromise();
5252
// No additional events after animation frame
53-
assert_false(popup.matches(':popup-open'));
53+
assert_false(popup.matches(':top-layer'));
5454
assert_equals(1,showCount);
5555
assert_equals(1,hideCount);
5656
}, 'Show and hide events get properly dispatched for popups');

html/semantics/popups/popup-focus.tentative.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
expectedFocusedElement = priorFocus;
133133
}
134134
assert_true(!!expectedFocusedElement);
135-
assert_false(popup.matches(':popup-open'));
135+
assert_false(popup.matches(':top-layer'));
136136

137137
// Directly show and hide the popup:
138138
priorFocus.focus();
@@ -156,7 +156,7 @@
156156
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by popup.showPopup()`);
157157
assert_equals(popup.popup, 'popup', 'All popups in this test should start as popup=popup');
158158
popup.popup = 'hint';
159-
assert_false(popup.matches(':popup-open'), 'Changing the popup type should hide the popup');
159+
assert_false(popup.matches(':top-layer'), 'Changing the popup type should hide the popup');
160160
assert_equals(document.activeElement, priorFocus, 'prior element should get focus when the type is changed');
161161
popup.popup = 'popup';
162162

@@ -165,7 +165,7 @@
165165
popup.showPopup();
166166
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by popup.showPopup()`);
167167
popup.remove();
168-
assert_false(popup.matches(':popup-open'), 'Removing the popup should hide it');
168+
assert_false(popup.matches(':top-layer'), 'Removing the popup should hide it');
169169
if (!popup.hasAttribute('data-no-focus')) {
170170
assert_not_equals(document.activeElement, priorFocus, 'prior element should *not* get focus when the popup is removed from the document');
171171
}
@@ -177,7 +177,7 @@
177177
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by popup.showPopup()`);
178178
const dialog = document.body.appendChild(document.createElement('dialog'));
179179
dialog.showModal();
180-
assert_false(popup.matches(':popup-open'), 'Opening a modal dialog should hide the popup');
180+
assert_false(popup.matches(':top-layer'), 'Opening a modal dialog should hide the popup');
181181
assert_not_equals(document.activeElement, priorFocus, 'prior element should *not* get focus when a modal dialog is shown');
182182
dialog.close();
183183
dialog.remove();
@@ -186,30 +186,30 @@
186186
const button = addInvoker(t, popup);
187187
priorFocus.focus();
188188
button.click();
189-
assert_true(popup.matches(':popup-open'));
189+
assert_true(popup.matches(':top-layer'));
190190
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by button.click()`);
191191

192192
// Make sure we can directly focus the (already open) popup:
193193
popup.focus();
194194
assert_equals(document.activeElement, popup.hasAttribute('tabindex') ? popup : expectedFocusedElement, `${testName} directly focus with popup.focus()`);
195195
button.click(); // Button is set to toggle the popup
196-
assert_false(popup.matches(':popup-open'));
196+
assert_false(popup.matches(':top-layer'));
197197
assert_equals(document.activeElement, priorFocus, 'prior element should get focus on button-toggled hide');
198198
}, "Popup focus test: " + testName);
199199

200200
promise_test(async t => {
201201
const priorFocus = addPriorFocus(t);
202-
assert_false(popup.matches(':popup-open'), 'popup should start out hidden');
202+
assert_false(popup.matches(':top-layer'), 'popup should start out hidden');
203203
let button = addInvoker(t, popup);
204204
assert_equals(button.getAttribute('togglepopup'), popup.id, 'This test assumes the button uses `togglepopup`.');
205205
assert_not_equals(button, priorFocus, 'Stranger things have happened');
206206
assert_false(popup.contains(button), 'Start with a non-contained button');
207207
priorFocus.focus();
208208
assert_equals(document.activeElement, priorFocus);
209209
popup.showPopup();
210-
assert_true(popup.matches(':popup-open'));
210+
assert_true(popup.matches(':top-layer'));
211211
await clickOn(button); // This will not light dismiss, but will "toggle" the popup.
212-
assert_false(popup.matches(':popup-open'));
212+
assert_false(popup.matches(':top-layer'));
213213
assert_equals(document.activeElement, priorFocus, 'Focus should return to prior focus');
214214

215215
// Same thing, but the button is contained within the popup
@@ -218,22 +218,22 @@
218218
popup.appendChild(button);
219219
priorFocus.focus();
220220
popup.showPopup();
221-
assert_true(popup.matches(':popup-open'));
221+
assert_true(popup.matches(':top-layer'));
222222
if (!popup.hasAttribute('data-no-focus')) {
223223
assert_not_equals(document.activeElement, priorFocus, 'focus should shift for this element');
224224
}
225225
await clickOn(button);
226-
assert_false(popup.matches(':popup-open'), 'clicking button should hide the popup');
226+
assert_false(popup.matches(':top-layer'), 'clicking button should hide the popup');
227227
assert_equals(document.activeElement, priorFocus, 'Contained button should return focus to the previously focused element');
228228

229229
// Same thing, but the button is unrelated (no togglepopup)
230230
button = document.createElement('button');
231231
document.body.appendChild(button);
232232
priorFocus.focus();
233233
popup.showPopup();
234-
assert_true(popup.matches(':popup-open'));
234+
assert_true(popup.matches(':top-layer'));
235235
await clickOn(button); // This will light dismiss the popup, focus the prior focus, then focus this button.
236-
assert_false(popup.matches(':popup-open'), 'clicking button should hide the popup (via light dismiss)');
236+
assert_false(popup.matches(':top-layer'), 'clicking button should hide the popup (via light dismiss)');
237237
assert_equals(document.activeElement, button, 'Focus should go to unrelated button on light dismiss');
238238
}, "Popup button click focus test: " + testName);
239239

@@ -243,12 +243,12 @@
243243
return;
244244
}
245245
const priorFocus = addPriorFocus(t);
246-
assert_false(popup.matches(':popup-open'), 'popup should start out hidden');
246+
assert_false(popup.matches(':top-layer'), 'popup should start out hidden');
247247

248248
// Move the prior focus out of the document
249249
priorFocus.focus();
250250
popup.showPopup();
251-
assert_true(popup.matches(':popup-open'));
251+
assert_true(popup.matches(':top-layer'));
252252
const newFocus = document.activeElement;
253253
assert_not_equals(newFocus, priorFocus, 'focus should shift for this element');
254254
priorFocus.remove();
@@ -260,11 +260,11 @@
260260
// Move the prior focus inside the (already open) popup
261261
priorFocus.focus();
262262
popup.showPopup();
263-
assert_true(popup.matches(':popup-open'));
263+
assert_true(popup.matches(':top-layer'));
264264
assert_false(popup.contains(priorFocus), 'Start with a non-contained prior focus');
265265
popup.appendChild(priorFocus); // Move inside the popup
266266
assert_true(popup.contains(priorFocus));
267-
assert_true(popup.matches(':popup-open'), 'popup should stay open');
267+
assert_true(popup.matches(':top-layer'), 'popup should stay open');
268268
popup.hidePopup();
269269
assert_not_equals(document.activeElement, priorFocus, 'focused element is display:none inside the popup');
270270
document.body.appendChild(priorFocus); // Put it back

html/semantics/popups/popup-inside-display-none.tentative.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<script>
1414
const popup = document.querySelector('[popup]');
1515
popup.showPopup();
16-
if (!popup.matches(':popup-open'))
16+
if (!popup.matches(':top-layer'))
1717
document.body.appendChild(document.createTextNode('FAIL'));
1818
script>

html/semantics/popups/popup-invoking-attribute.tentative.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
const otherId = expectedId !== 1 ? 1 : 2;
140140
function assert_popup(num,state,message) {
141141
assert_true(num>0,`Invalid expectedId ${num}`);
142-
assert_equals((num===1 ? popup1 : popup2).matches(':popup-open'),state,message || "");
142+
assert_equals((num===1 ? popup1 : popup2).matches(':top-layer'),state,message || "");
143143
}
144144
assert_popup(expectedId,false);
145145
assert_popup(otherId,false);
@@ -205,7 +205,7 @@
205205
popup.addEventListener('hide',() => ++hideCount);
206206

207207
async function assertState(expectOpen,expectShow,expectHide) {
208-
assert_equals(popup.matches(':popup-open'),expectOpen,'Popup open state is incorrect');
208+
assert_equals(popup.matches(':top-layer'),expectOpen,'Popup open state is incorrect');
209209
await new Promise(resolve => requestAnimationFrame(resolve));
210210
assert_equals(showCount,expectShow,'Show count is incorrect');
211211
assert_equals(hideCount,expectHide,'Hide count is incorrect');

html/semantics/popups/popup-light-dismiss-on-scroll.tentative.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
const popups = document.querySelectorAll('[popup]');
4040
function assertAll(showing) {
4141
for(let popup of popups) {
42-
assert_equals(popup.matches(':popup-open'),showing);
42+
assert_equals(popup.matches(':top-layer'),showing);
4343
}
4444
}
4545
async_test(t => {

0 commit comments

Comments
 (0)