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
--- 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();