diff options
Diffstat (limited to 'dom/base/test/file_focus_shadow_dom.html')
-rw-r--r-- | dom/base/test/file_focus_shadow_dom.html | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/dom/base/test/file_focus_shadow_dom.html b/dom/base/test/file_focus_shadow_dom.html index 6fa9d1b88e..7a0a0da729 100644 --- a/dom/base/test/file_focus_shadow_dom.html +++ b/dom/base/test/file_focus_shadow_dom.html @@ -79,10 +79,16 @@ opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)"); synthesizeKey("KEY_Tab"); opener.is(lastFocusTarget, shadowDate, "Should have focused date element with a calendar button in shadow DOM. (3)"); - synthesizeKey("KEY_Tab"); - opener.is(shadowIframe.contentDocument.activeElement, - shadowIframe.contentDocument.documentElement, - "Should have focused document element in shadow iframe. (3)"); + + let canTabMoveFocusToRootElement = + !SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element"); + if (canTabMoveFocusToRootElement) { + synthesizeKey("KEY_Tab"); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.documentElement, + "Should have focused document element in shadow iframe. (3)"); + } + synthesizeKey("KEY_Tab"); opener.is(shadowIframe.contentDocument.activeElement, shadowIframe.contentDocument.body.firstChild, @@ -99,10 +105,12 @@ opener.is(shadowIframe.contentDocument.activeElement, shadowIframe.contentDocument.body.firstChild, "Should have focused input element in shadow iframe. (4)"); - synthesizeKey("KEY_Tab", {shiftKey: true}); - opener.is(shadowIframe.contentDocument.activeElement, - shadowIframe.contentDocument.documentElement, - "Should have focused document element in shadow iframe. (4)"); + if (canTabMoveFocusToRootElement) { + synthesizeKey("KEY_Tab", {shiftKey: true}); + opener.is(shadowIframe.contentDocument.activeElement, + shadowIframe.contentDocument.documentElement, + "Should have focused document element in shadow iframe. (4)"); + } synthesizeKey("KEY_Tab", {shiftKey: true}); opener.is(lastFocusTarget, shadowDate, "Should have focused date element with a calendar button in shadow DOM. (4)"); synthesizeKey("KEY_Tab", {shiftKey: true}); |