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

Side by Side Diff: LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps.html

Issue 112553002: Implement new focusing steps for modal <dialog>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: drop inert ancestors change Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6 description('Tests focus when a modal dialog is opened.');
7
8 function test()
9 {
10 outerButton = document.getElementById('outer-button');
11 shouldBe('document.activeElement', 'outerButton');
12
13 debug('Test that focus goes to body if the dialog has no focusable elements, including itself');
14 var outerDialog = document.getElementById('outer-dialog');
15 outerDialog.showModal();
16 shouldBe('document.activeElement', 'document.body');
17
18 debug('Test that an autofocus element in the dialog gets focus.');
19 var dialog = document.getElementById('dialog');
20 dialog.showModal();
21 autofocusButton = document.getElementById('autofocus-button');
22 shouldBe('document.activeElement', 'autofocusButton');
23 dialog.close();
24
25 debug('... or else first focusable element in the dialog gets focus.');
26 autofocusButton.parentNode.removeChild(autofocusButton);
27 dialog.showModal();
28 firstButton = document.getElementById('first-button');
29 shouldBe('document.activeElement', 'firstButton');
30 dialog.close();
31
32 debug('... or else the dialog itself gets focus.');
33 var buttons = dialog.querySelectorAll('button');
34 for (var i = 0; i < buttons.length; ++i)
35 buttons[i].hidden = true;
36 dialog.showModal();
37 shouldBe('document.activeElement', 'dialog');
38 dialog.close();
39
40 document.getElementById('outer-dialog').close();
41 finishJSTest();
42 }
43 </script>
44 </head>
45 <body onload="test();">
46 <button id="outer-button" autofocus></button>
47 <dialog id="outer-dialog">
48 <dialog id="dialog" tabindex=0>
49 <button disabled></button>
50 <dialog>
51 <button autofocus></button>
52 </dialog>
53 <button id="first-button"></button>
54 <div>
55 <span>
56 <button id="autofocus-button" autofocus></button>
57 </span>
58 </div>
59 <button id="final-button"></button>
60 </dialog>
61 </dialog>
62 </body>
63 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698