diff --git a/html/semantics/popovers/popover-focus-2.html b/html/semantics/popovers/popover-focus-2.html
index 5fc8e7adf98040..3c1c6bed95cda4 100644
--- a/html/semantics/popovers/popover-focus-2.html
+++ b/html/semantics/popovers/popover-focus-2.html
@@ -17,17 +17,17 @@
Non-focusable popover
@@ -53,7 +53,7 @@
assert_equals(document.activeElement,control,`${description}: Step ${i+1} (backwards)`);
}
}
-promise_test(async t => {
+async function testPopoverFocusNavigation() {
button1.focus();
assert_equals(document.activeElement,button1);
await sendTab();
@@ -108,33 +108,110 @@
assert_equals(document.activeElement,button4,'Focus should skip popovers');
button1.focus();
await verifyFocusOrder([button1, button2, invoker0, invoker1, inside_popover1, invoker2, inside_popover3, invoker3, inside_popover2, button3, button4],'set 2');
-}, "Popover focus navigation");
+}
+promise_test(async t => {
+ invoker0.setAttribute('popovertarget', 'popover0');
+ invoker1.setAttribute('popovertarget', 'popover1');
+ invoker2.setAttribute('popovertarget', 'popover2');
+ invoker3.setAttribute('popovertarget', 'popover3');
+ t.add_cleanup(() => {
+ invoker0.removeAttribute('popovertarget');
+ invoker1.removeAttribute('popovertarget');
+ invoker2.removeAttribute('popovertarget');
+ invoker3.removeAttribute('popovertarget');
+ });
+ await testPopoverFocusNavigation();
+}, "Popover focus navigation with declarative invocation");
+
+promise_test(async t => {
+ const invoker0Click = () => {
+ popover0.togglePopover({ source: invoker0 });
+ };
+ invoker0.addEventListener('click', invoker0Click);
+ const invoker1Click = () => {
+ popover1.togglePopover({ source: invoker1 });
+ };
+ invoker1.addEventListener('click', invoker1Click);
+ const invoker2Click = () => {
+ popover2.togglePopover({ source: invoker2 });
+ };
+ invoker2.addEventListener('click', invoker2Click);
+ const invoker3Click = () => {
+ popover3.togglePopover({ source: invoker3 });
+ };
+ invoker3.addEventListener('click', invoker3Click);
+ t.add_cleanup(() => {
+ invoker0.removeEventListener('click', invoker0Click);
+ invoker1.removeEventListener('click', invoker1Click);
+ invoker2.removeEventListener('click', invoker2Click);
+ invoker3.removeEventListener('click', invoker3Click);
+ });
+ await testPopoverFocusNavigation()
+}, "Popover focus navigation with imperative invocation");
-
+
-
-
-
+
+
+
-
+
-
+
-
+
Popover with
Other focusable element
-
+
- Popover with
+ Popover with
Nested popover with