Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f26fc7403594226e4ff2d8d2beb1eaf616cda095 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../../resources/js-test.js"></script> |
| +<script src="../../forms/resources/common.js"></script> |
| +<script> |
| +description('Tests focus when a modal dialog is opened.'); |
| + |
| +function test() { |
| + document.getElementById('dialog').showModal(); |
| + shouldBe('document.activeElement', 'document.querySelector("[tabindex=\'0\']")') |
| + finishJSTest(); |
| +} |
| + |
| +jsTestIsAsync = true; |
| +window.onload = test; |
| +</script> |
| +</head> |
| +<body> |
| +<dialog id="dialog"> |
| + <div tabindex="-1">Negative tabindex shouldn't be focused</div> |
| + |
| + <!-- 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
|
| + <button tabindex="-1">button</button> |
| + <a href="#" tabindex="-1">anchor</a> |
| + --> |
| + |
| + <dialog> |
| + <button autofocus>Focus controls with [autofocus] should be ignored if inert</button> |
| + </dialog> |
| + |
| + <div tabindex="0">A div or custom element with tabindex >= 0 should be focused</div> |
| + |
| + <button>Form controls without [autofocus] shouldn't have higher precendence</button> |
| +</dialog> |
| +</body> |
| +</html> |