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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLDialogElement.cpp » ('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 <script src='../../resources/testharness.js'></script>
3 <script src='../../resources/testharnessreport.js'></script>
4 <!-- This test is testing unspecified behavior of using Shadow DOM in <dialog>.
5 See crbug/383230 and https://github.com/whatwg/html/issue/2393 . -->
6 <input id="outer">
7
8 <dialog id="dlg">
9 <div id="host"></div>
10 <button id="btn"></button>
11 </dialog>
12
13 <dialog id="dlg2">
14 <div id="host2"><input id="inner2"></div>
15 <button id="btn2"></button>
16 </dialog>
17 <script>
18 'use strict';
19
20 host.attachShadow({mode: 'open'}).innerHTML = '<input id="inner">';
21 let inner = host.shadowRoot.querySelector('#inner');
22
23 test(() => {
24 outer.focus();
25 assert_equals(document.activeElement, outer);
26
27 dlg.show();
28 assert_equals(document.activeElement, host);
29 assert_equals(host.shadowRoot.activeElement, inner);
30 dlg.close();
31
32 outer.focus();
33 assert_equals(document.activeElement, outer);
34
35 dlg.showModal();
36 assert_equals(document.activeElement, host);
37 assert_equals(host.shadowRoot.activeElement, inner);
38 dlg.close();
39 }, "Dialog focusing steps should be applied to elements inside ShadowRoot.");
40
41
42 host2.attachShadow({mode: 'open'}).innerHTML = '<slot></slot>';
43
44 test(() => {
45 outer.focus();
46 assert_equals(document.activeElement, outer);
47
48 dlg2.show();
49 assert_equals(document.activeElement, inner2);
50 dlg2.close();
51
52 outer.focus();
53 assert_equals(document.activeElement, outer);
54
55 dlg2.showModal();
56 assert_equals(document.activeElement, inner2);
57 dlg2.close();
58 }, "Dialog focusing steps should be applied to slotted elements in Shadow DOM.") ;
59 </script>
OLDNEW
« 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