Bug 1415787 - Add two extra elements in the SVG element to avoid losing focus. r=daoshengmu
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 21 Dec 2017 10:49:05 +0900
changeset 448888 1ca3a3798417706fcc0eeb3ca3070bc572626c64
parent 448887 4d07f50ba637177239af481eac9202d5e15a13eb
child 448889 27b617e2cad7ab540f9ad1026ed34730dbd74571
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaoshengmu
bugs1415787
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415787 - Add two extra elements in the SVG element to avoid losing focus. r=daoshengmu On MacOSX, more precisely if full keyboard access is not enabled on MacOSX, we skip focusing link elements in SVG with tab key, so if there is no more elements to be focused in the SVG, the focus will be moved outside the SVG. To prevent this situation, there needs more focusable elements in the SVG. MozReview-Commit-ID: HGGMjA0Asfw
dom/svg/test/test_tabindex.html
--- a/dom/svg/test/test_tabindex.html
+++ b/dom/svg/test/test_tabindex.html
@@ -19,16 +19,18 @@
     This is SVG text
   </text>
   <a xlink:href="#" id="l1" tabindex="3">
     <circle cx="10" cy="230" r="10"/>
   </a>
   <a id="l2" tabindex="4">
     <circle cx="10" cy="260" r="10"/>
   </a>
+  <rect id="r6" x="0" y="70" width="100" height="100" fill="yellow" tabindex="6"/>
+  <rect id="r7" x="0" y="70" width="100" height="100" fill="yellow" tabindex="7"/>
 </svg>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
   var f = document.getElementById('f');
@@ -70,27 +72,25 @@ function main()
     is(document.activeElement.tabIndex, 2, "The active element tabindex is 2");
 
     synthesizeKey("VK_TAB", {});
     is(document.activeElement.tabIndex, 3, "The active element tabindex is 3");
 
     synthesizeKey("VK_TAB", {});
     // On Mac, SVG link elements should not be focused.
     if (isMac) {
-      is(document.activeElement.tabIndex, 3, "The active element tabindex is 3");
+      is(document.activeElement.tabIndex, 6, "The active element tabindex is 6");
     } else {
       is(document.activeElement.tabIndex, 4, "The active element tabindex is 4");
     }
 
     synthesizeKey("VK_TAB", {});
     // On Mac, SVG link elements should not be focused.
     if (isMac) {
-      // This test has to be run with other tests, otherwise,
-      // document.activeElement.tabIndex will be -1 on Mac.
-      is(document.activeElement.tabIndex, 3, "The active element tabindex is 3");
+      is(document.activeElement.tabIndex, 7, "The active element tabindex is 7");
     } else {
       is(document.activeElement.tabIndex, 5, "The active element tabindex is 5");
     }
   } catch(e) {
     ok(false, "Got unexpected exception" + e);
   }
 
   SimpleTest.finish();