Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 <script src="../../forms/resources/common.js"></script> | |
| 6 <script> | |
| 7 description('Tests focus when a modal dialog is opened.'); | |
| 8 | |
| 9 function test() { | |
| 10 document.getElementById('dialog').showModal(); | |
| 11 shouldBe('document.activeElement', 'document.querySelector("[tabindex=\'0\'] ")') | |
| 12 finishJSTest(); | |
| 13 } | |
| 14 | |
| 15 jsTestIsAsync = true; | |
| 16 window.onload = test; | |
| 17 </script> | |
| 18 </head> | |
| 19 <body> | |
| 20 <dialog id="dialog"> | |
| 21 <div tabindex="-1">Negative tabindex shouldn't be focused</div> | |
| 22 | |
| 23 <!-- TODO(dbeam): add form controls and anchors with negative tabindex. | |
|
falken
2016/10/19 06:15:30
Can the TODO include information about when it is
| |
| 24 <button tabindex="-1">button</button> | |
| 25 <a href="#" tabindex="-1">anchor</a> | |
| 26 --> | |
| 27 | |
| 28 <dialog> | |
| 29 <button autofocus>Focus controls with [autofocus] should be ignored if i nert</button> | |
| 30 </dialog> | |
| 31 | |
| 32 <div tabindex="0">A div or custom element with tabindex >= 0 should be focus ed</div> | |
| 33 | |
| 34 <button>Form controls without [autofocus] shouldn't have higher precendence< /button> | |
| 35 </dialog> | |
| 36 </body> | |
| 37 </html> | |
| OLD | NEW |