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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus.html

Issue 2428333002: <dialog>: don't focus non-form elements with tabindex < 0 when showModal() is called (Closed)
Patch Set: asdf Created 4 years, 2 months 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698