Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate focus handling logic from <popup> to Element [popup 7/7] #33437

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions html/semantics/popups/popup-focus.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<button>first button</button>
</div>

<div popup=popup data-test='autofocus popup' autofocus class=should-be-focused>
<div popup=popup data-test='autofocus popup' autofocus tabindex=-1 class=should-be-focused>
<p>This is a popup</p>
</div>

<div popup=popup data-test='autofocus empty popup' autofocus class=should-be-focused></div>
<div popup=popup data-test='autofocus empty popup' autofocus tabindex=-1 class=should-be-focused></div>

<div popup=popup data-test='autofocus popup with button' autofocus class=should-be-focused>
<div popup=popup data-test='autofocus popup with button' autofocus tabindex=-1 class=should-be-focused>
<p>This is a popup</p>
<button>button</button>
</div>
Expand All @@ -38,7 +38,7 @@
<button autofocus>second autofocus button</button>
</div>

<div popup=popup autofocus data-test='autofocus popup and multiple autofocus children' class=should-be-focused>
<div popup=popup autofocus tabindex=-1 data-test='autofocus popup and multiple autofocus children' class=should-be-focused>
<p>This is a popup</p>
<button autofocus>autofocus button</button>
<button autofocus>second autofocus button</button>
Expand Down Expand Up @@ -129,14 +129,14 @@
button.remove();
});
popup.id = popupId;
button.setAttribute('popup', popupId);
button.setAttribute('triggerpopup', popupId);
priorFocus.focus();
button.click();
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by button.click()`);

// Make sure we can directly focus the (already open) popup:
popup.focus();
assert_equals(document.activeElement, popup.hasAttribute('delegatesfocus') ? expectedFocusedElement : popup, `${testName} directly focus with popup.focus()`);
assert_equals(document.activeElement, popup.hasAttribute('tabindex') ? popup : expectedFocusedElement, `${testName} directly focus with popup.focus()`);
popup.hidePopup();
}, "Popup focus test: " + testName);
}
Expand Down