Title: [292307] trunk/LayoutTests/imported/w3c
Revision
292307
Author
[email protected]
Date
2022-04-04 11:27:47 -0700 (Mon, 04 Apr 2022)

Log Message

Make focus-after-close.html WPT pass
https://bugs.webkit.org/show_bug.cgi?id=233525

Reviewed by Simon Fraser.

The last subtest doesn't pass, because WebKit intentionally differs from other browsers by scrolling
to the focused element asynchronously (see bug 181575). Wait for a scroll event + tick to make it pass.

* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close-expected.txt:
* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292306 => 292307)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-04 18:11:11 UTC (rev 292306)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-04 18:27:47 UTC (rev 292307)
@@ -1,3 +1,16 @@
+2022-04-04  Tim Nguyen  <[email protected]>
+
+        Make focus-after-close.html WPT pass
+        https://bugs.webkit.org/show_bug.cgi?id=233525
+
+        Reviewed by Simon Fraser.
+
+        The last subtest doesn't pass, because WebKit intentionally differs from other browsers by scrolling
+        to the focused element asynchronously (see bug 181575). Wait for a scroll event + tick to make it pass.
+
+        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close-expected.txt:
+        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close.html:
+
 2022-04-04  Youenn Fablet  <[email protected]>
 
         CORS: Allow particular Range header values without a preflight

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close-expected.txt (292306 => 292307)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close-expected.txt	2022-04-04 18:11:11 UTC (rev 292306)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close-expected.txt	2022-04-04 18:27:47 UTC (rev 292307)
@@ -6,5 +6,5 @@
 PASS Focus should be moved to the previously focused element even if it has moved to shadow DOM root in between show/close
 PASS Focus should be moved to the body if the previously focused element is removed
 PASS Focus should be moved to the shadow DOM host if the previouly focused element is a shadow DOM node
-FAIL Focus should not scroll if the previously focused element is outside the viewport assert_true: expected true got false
+PASS Focus should not scroll if the previously focused element is outside the viewport
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close.html (292306 => 292307)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close.html	2022-04-04 18:11:11 UTC (rev 292306)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/focus-after-close.html	2022-04-04 18:27:47 UTC (rev 292307)
@@ -160,13 +160,17 @@
 }
 
 // Test moving the focus doesn't scroll the viewport
-function test_move_focus_dont_scroll_viewport(showModal) {
+async function test_move_focus_dont_scroll_viewport(showModal) {
   const outViewPortButton = document.createElement("button");
   outViewPortButton.style.top = (window.innerHeight + 10).toString() + "px";
   outViewPortButton.style.position = "absolute";
   document.body.appendChild(outViewPortButton);
 
-  outViewPortButton.focus();
+  await new Promise(resolve => {
+    document.addEventListener("scroll", () => step_timeout(resolve, 0));
+    outViewPortButton.focus();
+  });
+
   // Since the outViewPortButton is focused, so the viewport should be
   // scrolled to it
   assert_true(document.documentElement.scrollTop > 0 );
@@ -217,9 +221,9 @@
   test_move_to_shadow_host(false);
 }, "Focus should be moved to the shadow DOM host if the previouly focused element is a shadow DOM node");
 
-test(() => {
-  test_move_focus_dont_scroll_viewport(true);
-  test_move_focus_dont_scroll_viewport(false);
+promise_test(async () => {
+  await test_move_focus_dont_scroll_viewport(true);
+  await test_move_focus_dont_scroll_viewport(false);
 }, "Focus should not scroll if the previously focused element is outside the viewport");
 </script>
 </body>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to