|
1 | 1 | <!DOCTYPE html>
|
2 |
| -<title>moveBefore should handle focus bubbling correctly</title> |
| 2 | +<title>moveBefore should not fire focus events</title> |
3 | 3 | <script src="/resources/testharness.js"></script>
|
4 | 4 | <script src="/resources/testharnessreport.js"></script>
|
5 | 5 | <body>
|
|
48 | 48 | new_parent.moveBefore(button, null);
|
49 | 49 | assert_collected_events_equals(collected_events, [
|
50 | 50 | {type: "focusin", target: button},
|
51 |
| - {type: "focusout", target: old_parent}, |
52 |
| - {type: "focusin", target: new_parent} |
53 | 51 | ]);
|
54 |
| -}, "Fire focusin/out when reparenting focused element directly"); |
| 52 | +}, "Don't fire focusin/out when reparenting focused element directly"); |
55 | 53 |
|
56 | 54 | test(t => {
|
57 | 55 | const collected_events = collect_focusinout_events(t);
|
|
62 | 60 | new_parent.moveBefore(old_parent, null);
|
63 | 61 | assert_collected_events_equals(collected_events, [
|
64 | 62 | {type: "focusin", target: button},
|
65 |
| - {type: "focusout", target: document.body}, |
66 |
| - {type: "focusin", target: new_parent} |
67 | 63 | ]);
|
68 |
| -}, "Fire focusin/out when reparenting an element that has focus within"); |
| 64 | +}, "Don't fire focusin/out when reparenting an element that has focus within"); |
69 | 65 |
|
70 | 66 | test(t => {
|
71 | 67 | const collected_events = collect_focusinout_events(t);
|
|
88 | 84 | button.focus();
|
89 | 85 | inert_parent.moveBefore(button, null);
|
90 | 86 | assert_collected_events_equals(collected_events, [
|
91 |
| - {type: "focusin", target: button}, |
92 |
| - {type: "focusout", target: old_parent}, |
93 |
| - {type: "focusin", target: inert_parent} |
94 |
| - ]); |
| 87 | + {type: "focusin", target: button}]); |
95 | 88 | await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
|
96 | 89 | assert_collected_events_equals(collected_events, [
|
97 | 90 | {type: "focusin", target: button},
|
98 |
| - {type: "focusout", target: old_parent}, |
99 |
| - {type: "focusin", target: inert_parent}, |
100 | 91 | {type: "focusout", target: button},
|
101 | 92 | ]);
|
102 |
| -}, "Fire focusin and then correct when moving to an inert subtree"); |
| 93 | +}, "Don't fire focusin and then correct when moving to an inert subtree"); |
103 | 94 |
|
104 | 95 | promise_test(async t => {
|
105 | 96 | const collected_events = collect_focusinout_events(t);
|
|
111 | 102 | inert_when_not_empty_parent.moveBefore(button, null);
|
112 | 103 | assert_collected_events_equals(collected_events, [
|
113 | 104 | {type: "focusin", target: button},
|
114 |
| - {type: "focusout", target: old_parent}, |
115 |
| - {type: "focusin", target: inert_when_not_empty_parent} |
116 | 105 | ]);
|
117 | 106 | await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
|
118 | 107 | assert_collected_events_equals(collected_events, [
|
119 | 108 | {type: "focusin", target: button},
|
120 |
| - {type: "focusout", target: old_parent}, |
121 |
| - {type: "focusin", target: inert_when_not_empty_parent}, |
122 | 109 | {type: "focusout", target: button},
|
123 | 110 | ]);
|
124 |
| -}, "Fire focusin and then correct when moving to a tree that is made inert using style"); |
| 111 | +}, "Don't fire focusin and then correct when moving to a tree that is made inert using style"); |
125 | 112 |
|
126 | 113 | </script>
|
0 commit comments