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

Unified Diff: third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html

Issue 2715793003: Allow an element in shadow tree in <dialog> to be initially focused. (Closed)
Patch Set: Update the comment. Created 3 years, 10 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/Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html
diff --git a/third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html b/third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html
new file mode 100644
index 0000000000000000000000000000000000000000..8fab4905e88528cf4e616d8a5f1850251cc4ff59
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/html/dialog/shadowdom-in-dialog.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<script src='../../resources/testharness.js'></script>
+<script src='../../resources/testharnessreport.js'></script>
+<!-- This test is testing unspecified behavior of using Shadow DOM in <dialog>.
+See crbug/383230 and https://github.com/whatwg/html/issue/2393 . -->
+<input id="outer">
+
+<dialog id="dlg">
+ <div id="host"></div>
+ <button id="btn"></button>
+</dialog>
+
+<dialog id="dlg2">
+ <div id="host2"><input id="inner2"></div>
+ <button id="btn2"></button>
+</dialog>
+<script>
+'use strict';
+
+host.attachShadow({mode: 'open'}).innerHTML = '<input id="inner">';
+let inner = host.shadowRoot.querySelector('#inner');
+
+test(() => {
+ outer.focus();
+ assert_equals(document.activeElement, outer);
+
+ dlg.show();
+ assert_equals(document.activeElement, host);
+ assert_equals(host.shadowRoot.activeElement, inner);
+ dlg.close();
+
+ outer.focus();
+ assert_equals(document.activeElement, outer);
+
+ dlg.showModal();
+ assert_equals(document.activeElement, host);
+ assert_equals(host.shadowRoot.activeElement, inner);
+ dlg.close();
+}, "Dialog focusing steps should be applied to elements inside ShadowRoot.");
+
+
+host2.attachShadow({mode: 'open'}).innerHTML = '<slot></slot>';
+
+test(() => {
+ outer.focus();
+ assert_equals(document.activeElement, outer);
+
+ dlg2.show();
+ assert_equals(document.activeElement, inner2);
+ dlg2.close();
+
+ outer.focus();
+ assert_equals(document.activeElement, outer);
+
+ dlg2.showModal();
+ assert_equals(document.activeElement, inner2);
+ dlg2.close();
+}, "Dialog focusing steps should be applied to slotted elements in Shadow DOM.");
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLDialogElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698