Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html

Issue 2532983004: Re-work <dialog>#show*() focus algorithm (Closed)
Patch Set: starting to mess with tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html
index 41dde1826f73e07c846b1329b22611dd6809352e..0263b876f782c96d737153b97799574eff93e46f 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html
@@ -11,9 +11,13 @@ function test()
outerButton = document.getElementById('outer-button');
shouldBe('document.activeElement', 'outerButton');
- debug('Test that focus goes to body if the dialog has no focusable elements, including itself');
- var outerDialog = document.getElementById('outer-dialog');
+ debug('Test that focus goes to outerDialog when shown');
+ outerDialog = document.getElementById('outer-dialog');
outerDialog.showModal();
+ shouldBe('document.activeElement', 'outerDialog');
+
+ debug('Test that the activeElement changes to body if outerDialog is blurred');
+ outerDialog.blur();
shouldBe('document.activeElement', 'document.body');
debug('Test that an autofocus element in the dialog gets focus.');
@@ -23,21 +27,6 @@ function test()
shouldBe('document.activeElement', 'autofocusButton');
dialog.close();
- debug('... or else first focusable element in the dialog gets focus.');
- autofocusButton.parentNode.removeChild(autofocusButton);
- dialog.showModal();
- firstButton = document.getElementById('first-button');
- shouldBe('document.activeElement', 'firstButton');
- dialog.close();
-
- debug('... or else the dialog itself gets focus.');
- var buttons = dialog.querySelectorAll('button');
- for (var i = 0; i < buttons.length; ++i)
- buttons[i].hidden = true;
- dialog.showModal();
- shouldBe('document.activeElement', 'dialog');
- dialog.close();
-
document.getElementById('outer-dialog').close();
finishJSTest();
}
@@ -50,6 +39,8 @@ waitUntilLoadedAndAutofocused(test);
<button id="outer-button" autofocus></button>
<dialog id="outer-dialog">
<dialog id="dialog" tabindex=0>
+ <!-- div[autofocus] is ignored as [autofocus] only applies to form controls. -->
+ <div autofocus></div>
<button disabled></button>
<dialog>
<button autofocus></button>

Powered by Google App Engine
This is Rietveld 408576698