Skip to content

Commit

Permalink
Bug 1762314 [wpt PR 33437] - Migrate focus handling logic from <popup…
Browse files Browse the repository at this point in the history
…> to Element [popup 7/7], a=testonly

Automatic update from web-platform-tests
Migrate focus handling logic from <popup> to Element [popup 7/7]

This moves the focus management stuff out of HTMLPopupElement and into
Element, to work with both <popup> and <div popup>.

With this CL, all of the WPTs now pass, with the exception of the one
for the anchor IDL property, which is an open issue [1].

[1] openui/open-ui#382

Bug: 1307772
Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291
Reviewed-by: David Baron <dbaron@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988069}

--

wpt-commits: 7e58a49e306020dbc50c235ad093356152b1d72b
wpt-pr: 33437
  • Loading branch information
Mason Freed authored and moz-wptsync-bot committed Apr 11, 2022
1 parent d35ccff commit 0170fbf
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 0170fbf

Please sign in to comment.