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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html

Issue 1840333002: Support slots' fallback contents in focus navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/FocusController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html b/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..7586ff230138c29bfc58c24f5c7ffaa40a01ca34
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<script src='../fast/dom/shadow/resources/shadow-dom.js'></script>
+<script src='resources/shadow-dom.js'></script>
+<div id="log"></div>
+<p>
+ document tree: [i0 -> [x-foo]]<br>
+ x-foo's shadow tree: [j1 -> j2 -> [s1]]<br>
+ <b>slot #s1: [k1 -> [x-bar] -> k0 -> [s2] -> [s3]]</b><br>
+ x-bar's shadow tree: [m1 -> m2]<br>
+ slot #s2: [i1 -> i2]<br>
+ <b>slot #s3: [l1]<b><br><br>
+ <b>v1 ideal nav forward: [i0 -> j1 -> j2 -> k1 -> x-bar -> m1 -> m2 -> k0 -> i1 -> i2 -> l1]</b><br>
+</p>
+
+<input id="i0" tabindex=0 value="i0">
+<div id="x-foo">
+ <input id="i2" slot="s2" tabindex=2 value="i2">
+ <input id="i1" slot="s2" tabindex=1 value="i1">
+ <template data-mode="open">
+ <input id="j1" tabindex=1 value="j1">
+ <slot id="s1" name="s1"> <!-- This slot does not have any assigned elements -->
+ <input id="k0" tabindex=0 value="k0">
+ <input id="k1" tabindex=1 value="k1">
+ <slot id="s2" name="s2">
+ <input id="should-be-ignored">
+ </slot>
+ <slot id="s3" name="s3"> <!-- This slot does not have any assigned elements -->
+ <input id="l1" value="l1">
+ </slot>
+ <div id="x-bar" tabindex=2>
+ <template data-mode="open">
+ <input id="m2" value="m2" tabindex=2>
+ <input id="m1" value="m1" tabindex=1>
+ </template>
+ </div>
+ </slot>
+ <input id="j2" tabindex=2 value="j2">
+ </template>
+</div>
+
+<script>
+
+test(function() {
+ var xfoo = document.getElementById('x-foo');
+ convertTemplatesToShadowRootsWithin(xfoo);
+
+ var elements = [
+ 'i0',
+ 'x-foo/j1',
+ 'x-foo/j2',
+ 'x-foo/k1',
+ 'x-foo/x-bar',
+ 'x-foo/x-bar/m1',
+ 'x-foo/x-bar/m2',
+ 'x-foo/k0',
+ 'i1',
+ 'i2',
+ 'x-foo/l1'
+ ];
+
+ for (var i = 0; i + 1 < elements.length; ++i)
+ assert_true(shouldNavigateFocus(elements[i], elements[i + 1], 'forward'), elements[i] + ' to ' + elements[i + 1]);
+ elements.reverse();
+ for (var i = 0; i + 1 < elements.length; ++i)
+ assert_true(shouldNavigateFocus(elements[i], elements[i + 1], 'backward'), elements[i] + ' to ' + elements[i + 1]);
+}, 'Focus should jump to fallback elements when a slot does not have any assigned nodes.');
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698