Skip to content

Commit

Permalink
Bug 1930252 [wpt PR 49076] - moveBefore: don't fire focusin/focusout,…
Browse files Browse the repository at this point in the history
… a=testonly

Automatic update from web-platform-tests
moveBefore: don't fire focusin/focusout

Following spec conversation at WHATNOT, this will be deferred
until we receive community feedback.

Bug: 40150299
Change-Id: I18dc4ebd50d52fa83ea3a4cc8cf376e7b33d835b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5992801
Commit-Queue: Dominic Farolino <[email protected]>
Reviewed-by: Dominic Farolino <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1380625}

--

wpt-commits: e44f4535f4fe673f00e6f487c6240a4c4647b5a6
wpt-pr: 49076
  • Loading branch information
noamr authored and moz-wptsync-bot committed Nov 9, 2024
1 parent 229ed0a commit 4ccd84a
Showing 1 changed file with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>moveBefore should handle focus bubbling correctly</title>
<title>moveBefore should not fire focus events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
Expand Down Expand Up @@ -48,10 +48,8 @@
new_parent.moveBefore(button, null);
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: old_parent},
{type: "focusin", target: new_parent}
]);
}, "Fire focusin/out when reparenting focused element directly");
}, "Don't fire focusin/out when reparenting focused element directly");

test(t => {
const collected_events = collect_focusinout_events(t);
Expand All @@ -62,10 +60,8 @@
new_parent.moveBefore(old_parent, null);
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: document.body},
{type: "focusin", target: new_parent}
]);
}, "Fire focusin/out when reparenting an element that has focus within");
}, "Don't fire focusin/out when reparenting an element that has focus within");

test(t => {
const collected_events = collect_focusinout_events(t);
Expand All @@ -88,18 +84,13 @@
button.focus();
inert_parent.moveBefore(button, null);
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: old_parent},
{type: "focusin", target: inert_parent}
]);
{type: "focusin", target: button}]);
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: old_parent},
{type: "focusin", target: inert_parent},
{type: "focusout", target: button},
]);
}, "Fire focusin and then correct when moving to an inert subtree");
}, "Don't fire focusin and then correct when moving to an inert subtree");

promise_test(async t => {
const collected_events = collect_focusinout_events(t);
Expand All @@ -111,16 +102,12 @@
inert_when_not_empty_parent.moveBefore(button, null);
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: old_parent},
{type: "focusin", target: inert_when_not_empty_parent}
]);
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
assert_collected_events_equals(collected_events, [
{type: "focusin", target: button},
{type: "focusout", target: old_parent},
{type: "focusin", target: inert_when_not_empty_parent},
{type: "focusout", target: button},
]);
}, "Fire focusin and then correct when moving to a tree that is made inert using style");
}, "Don't fire focusin and then correct when moving to a tree that is made inert using style");

</script>

0 comments on commit 4ccd84a

Please sign in to comment.