Skip to content

Commit 42cf9d5

Browse files
mfreed7chromium-wpt-export-bot
authored andcommitted
Remove focus fixup for removal of <dialog open> attribute
See the conversation here: whatwg/html#10953 (comment) This changes the behavior of the DialogCloseWhenOpenRemovedEnabled flag just a bit, to move toward "option 2" from the comment just below the one linked above. It also cleans up the two parameters to ::close(), and replaces them with one. And it stops doing the focus fixup behaviors in that case. Bug: 376516550 Change-Id: I072d710df47bbe58f5137070591378c72f8124b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6244982 Auto-Submit: Mason Freed <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1419540}
1 parent 4015309 commit 42cf9d5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.tentative.html

+10-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
await new Promise(resolve => t.step_timeout(resolve, 0));
3434
await new Promise(requestAnimationFrame);
3535

36-
assert_equals(document.activeElement, button,
37-
'Previously focused element should be focused after waiting for a task.');
36+
assert_not_equals(document.activeElement, button,
37+
'Previously focused element should not be focused, even after waiting for a task.');
3838
assert_false(dialog.matches(':modal'),
3939
'The dialog should not match :modal after closing.');
4040
assert_false(cancelFired,
@@ -47,6 +47,9 @@
4747
await test_driver.click(button);
4848
assert_true(buttonFiredClick,
4949
'The page should not be inert or blocked after removing the open attribute.');
50+
// Clean up
51+
dialog.showModal();
52+
dialog.close();
5053
}, 'Removing the open attribute from an open modal dialog should run the closing algorithm.');
5154

5255
promise_test(async t => {
@@ -66,11 +69,14 @@
6669
await new Promise(resolve => t.step_timeout(resolve, 0));
6770
await new Promise(requestAnimationFrame);
6871

69-
assert_equals(document.activeElement, button,
70-
'Previously focused element should be focused after waiting for a task.');
72+
assert_not_equals(document.activeElement, button,
73+
'Previously focused element should not be focused, even after waiting for a task.');
7174
assert_false(cancelFired,
7275
'The cancel event should not fire when removing the open attribute.');
7376
assert_true(closeFired,
7477
'The close event should be fired when removing the open attribute.');
78+
// Clean up
79+
dialog.show();
80+
dialog.close();
7581
}, 'Removing the open attribute from an open non-modal dialog should fire a close event.');
7682
</script>

0 commit comments

Comments
 (0)