skips-root-focusgroup-complex-case.html (1762B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTML Test: focusgroup - Focus moves to previous item and skips focusgroup root subtree (complex case).</title> 4 <link rel="author" title="Microsoft" href="http://www.microsoft.com/"> 5 <link rel="help" href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Focusgroup/explainer.md"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="../resources/focusgroup-utils.js"></script> 12 13 <div focusgroup="toolbar wrap"> 14 <span id=item1 tabindex=0>item1</span> 15 <div> 16 <div focusgroup="toolbar"> 17 <div id=item2 tabindex=0> 18 <div focusgroup="toolbar"> 19 <span id=item3 tabindex=0>item3</span> 20 <span id=item4 tabindex=0>item4</span> 21 </div> 22 </div> 23 </div> 24 </div> 25 <span id=item5 tabindex=0>item5</span> 26 </div> 27 28 <script> 29 30 promise_test(async t => { 31 var item1 = document.getElementById("item1"); 32 var item5 = document.getElementById("item5"); 33 34 await focusAndKeyPress(item5, kArrowUp); 35 assert_equals(document.activeElement, item1); 36 37 await focusAndKeyPress(item5, kArrowLeft); 38 assert_equals(document.activeElement, item1); 39 }, "When the focus is set on the last item of a focusgroup and the previous item is located past an other (non-extending) focusgroup subtree, a backward arrow key press should move the focus to that previous item without getting stuck in the other focusgroup. The same should still be true when inside a focusgroup that extends a root focusgroup within the original focusgroup."); 40 41 </script>