-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=270017 Reviewed by Anne van Kesteren. Upstream commit: web-platform-tests/wpt@da26ae6 * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/resources/resource-files.json: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/WEB_FEATURES.yml: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/backdrop-stacking-order.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focus-previous-outside.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusability-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusability.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-generated-content.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/modal-dialog-selection-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-display-none.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-remove-popover-attribute-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-remove-popover-attribute-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-remove-popover-attribute.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-dynamic.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log: Canonical link: https://commits.webkit.org/275283@main
- Loading branch information
1 parent
669e172
commit bb7f816
Showing
21 changed files
with
203 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...eb-platform-tests/html/semantics/interactive-elements/the-dialog-element/WEB_FEATURES.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
features: | ||
- name: dialog | ||
files: "**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
button | ||
|
||
FAIL Removing the open attribute from an open modal dialog should run the closing algorithm. assert_false: The dialog should not match :modal after closing. expected false got true | ||
FAIL Removing the open attribute from an open non-modal dialog should fire a close event. assert_true: The close event should be fired when removing the open attribute. expected true got false | ||
|
59 changes: 59 additions & 0 deletions
59
...ts/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:jarhar@chromium.org"> | ||
<link rel=help href="https://github.com/whatwg/html/issues/5802"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<button>button</button> | ||
<dialog>hello world</dialog> | ||
|
||
<script> | ||
const dialog = document.querySelector('dialog'); | ||
const button = document.querySelector('button'); | ||
|
||
promise_test(async t => { | ||
dialog.showModal(); | ||
|
||
let closeFired = false; | ||
let cancelFired = false; | ||
dialog.addEventListener('close', () => closeFired = true); | ||
dialog.addEventListener('cancel', () => cancelFired = true); | ||
|
||
dialog.removeAttribute('open'); | ||
await new Promise(resolve => t.step_timeout(resolve, 0)); | ||
await new Promise(requestAnimationFrame); | ||
|
||
assert_false(dialog.matches(':modal'), | ||
'The dialog should not match :modal after closing.'); | ||
assert_false(cancelFired, | ||
'The cancel event should not fire when removing the open attribute.'); | ||
assert_true(closeFired, | ||
'The close event should be fired when removing the open attribute.'); | ||
|
||
let buttonFiredClick = false; | ||
button.addEventListener('click', () => buttonFiredClick = true); | ||
await test_driver.click(button); | ||
assert_true(buttonFiredClick, | ||
'The page should not be inert or blocked after removing the open attribute.'); | ||
}, 'Removing the open attribute from an open modal dialog should run the closing algorithm.'); | ||
|
||
promise_test(async t => { | ||
dialog.show(); | ||
|
||
let closeFired = false; | ||
let cancelFired = false; | ||
dialog.addEventListener('close', () => closeFired = true); | ||
dialog.addEventListener('cancel', () => cancelFired = true); | ||
|
||
dialog.removeAttribute('open'); | ||
await new Promise(resolve => t.step_timeout(resolve, 0)); | ||
await new Promise(requestAnimationFrame); | ||
|
||
assert_false(cancelFired, | ||
'The cancel event should not fire when removing the open attribute.'); | ||
assert_true(closeFired, | ||
'The close event should be fired when removing the open attribute.'); | ||
}, 'Removing the open attribute from an open non-modal dialog should fire a close event.'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...s/html/semantics/interactive-elements/the-dialog-element/dialog-focusability-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: assert_equals: Focus order mismatch at step 2/11 expected Element node <button id="within1">button</button> but got Element node <dialog tabindex="0" id="dialog2" open=""> | ||
<button id="... | ||
before button after 1 button after 2 button after 3 button after 4 | ||
|
||
Harness Error (FAIL), message = Unhandled rejection: assert_equals: Focus order mismatch at step 2/11 expected Element node <button id="within1">button</button> but got Element node <dialog tabindex="0" id="dialog2" open=""> | ||
<button id="... | ||
|
||
TIMEOUT The dialog element itself should not be keyboard focusable. Test timed out | ||
|
||
Harness Error (FAIL), message = Unhandled rejection: assert_equals: Focus order mismatch at step 2/11 expected Element node <button id="within1">button</button> but got Element node <dialog tabindex="0" id="dialog2" open=""> | ||
<button id="... | ||
|
||
TIMEOUT The dialog element itself should not be keyboard focusable. Test timed out | ||
|
58 changes: 58 additions & 0 deletions
58
...orm-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusability.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>dialog element: focusability</title> | ||
<link rel=help href="https://github.com/whatwg/html/pull/8199"> | ||
<link rel=author href="mailto:masonf@chromium.org"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
|
||
<button id="before">before</button> | ||
<dialog id="dialog1" open> | ||
<button id="within1">button</button> | ||
</dialog> | ||
<button id="after1">after 1</button> | ||
<dialog tabindex=0 id="dialog2" open> | ||
<button id="within2">button</button> | ||
</dialog> | ||
<button id="after2">after 2</button> | ||
<dialog tabindex="-1" id="dialog3" open> | ||
<button id="within3">button</button> | ||
</dialog> | ||
<button id="after3">after 3</button> | ||
<dialog contenteditable="true" id="dialog4" open> | ||
<button id="within4">button</button> | ||
</dialog> | ||
<button id="after4">after 4</button> | ||
|
||
<style> | ||
#dialog1 { top: 25px; } | ||
#dialog2 { top: 100px; } | ||
#dialog3 { top: 175px; } | ||
#dialog4 { top: 250px; } | ||
</style> | ||
|
||
<script> | ||
function navigateForward() { | ||
const TAB = '\ue004'; | ||
return test_driver.send_keys(document.body, TAB); | ||
} | ||
async function assert_focus_order(elements) { | ||
assert_true(elements.length >= 2); | ||
elements[0].focus(); | ||
for(let i=0;i<elements.length;++i) { | ||
assert_equals(document.activeElement,elements[i],`Focus order mismatch at step ${i+1}/${elements.length}`); | ||
await navigateForward(); | ||
} | ||
} | ||
|
||
async_test((t) => { | ||
window.onload = async () => { | ||
await assert_focus_order([before,within1,after1,dialog2,within2,after2, | ||
within3,after3,dialog4,within4,after4]); | ||
t.done(); | ||
}; | ||
}, "The dialog element itself should not be keyboard focusable."); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-display-none.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...tform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
.../interactive-elements/the-dialog-element/top-layer-remove-popover-attribute-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<head> | ||
<title>Shown modal dialog where the popover attribute is removed</title> | ||
</head> | ||
<body> | ||
<dialog popover style="padding: 2em"></dialog> | ||
<script> | ||
const d = document.querySelector("dialog"); | ||
d.showModal(); | ||
</script> | ||
</body> | ||
<html> | ||
|
15 changes: 15 additions & 0 deletions
15
...ntics/interactive-elements/the-dialog-element/top-layer-remove-popover-attribute-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<head> | ||
<title>Shown modal dialog where the popover attribute is removed</title> | ||
</head> | ||
<body> | ||
<dialog popover style="padding: 2em"></dialog> | ||
<script> | ||
const d = document.querySelector("dialog"); | ||
d.showModal(); | ||
</script> | ||
</body> | ||
<html> | ||
|
18 changes: 18 additions & 0 deletions
18
...semantics/interactive-elements/the-dialog-element/top-layer-remove-popover-attribute.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<meta name="assert" content="Removing the popover attribute of a hidden popover should not remove the dialog from the top layer."> | ||
<head> | ||
<title>Shown modal dialog where the popover attribute is removed</title> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/popover.html#hide-popover-algorithm"> | ||
<link rel="match" href="top-layer-remove-popover-attribute-ref.html"> | ||
</head> | ||
<body> | ||
<dialog popover style="padding: 2em"></dialog> | ||
<script> | ||
const d = document.querySelector("dialog"); | ||
d.showModal(); | ||
d.popover = null; | ||
</script> | ||
</body> | ||
<html> |
1 change: 0 additions & 1 deletion
1
...ts/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-dynamic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters