Skip to content

Commit d769a3c

Browse files
authored
Fix the issue #51441 by waiting for the actual scrolling to happen in test_move_focus_dont_scroll_viewport. (#51442)
Because scrolling to the button may happen over a period of time, we can't assume that scrollTop has moved when we receive the first scroll event.
1 parent d4246a8 commit d769a3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

html/semantics/interactive-elements/the-dialog-element/focus-after-close.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@
167167
document.body.appendChild(outViewPortButton);
168168

169169
await new Promise(resolve => {
170-
document.addEventListener("scroll", resolve, { once: true });
170+
document.addEventListener("scroll", () => {
171+
if (resolve && document.documentElement.scrollTop) {
172+
resolve();
173+
resolve = null;
174+
}
175+
});
171176
outViewPortButton.focus();
172177
});
173178

0 commit comments

Comments
 (0)