mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1703171: Support a11y exposure of accessKey for elements in shadow DOM. r=morgan
Previously, when determining the modifier, the code used the uncomposed document, which will be null for an element inside shadow DOM. Differential Revision: https://phabricator.services.mozilla.com/D111033
This commit is contained in:
parent
950a63fea5
commit
cc19c08fbf
@ -250,7 +250,7 @@ KeyBinding LocalAccessible::AccessKey() const {
|
||||
}
|
||||
|
||||
// Determine the access modifier used in this context.
|
||||
dom::Document* document = mContent->GetUncomposedDoc();
|
||||
dom::Document* document = mContent->GetComposedDoc();
|
||||
if (!document) return KeyBinding();
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(document->GetDocShell());
|
||||
|
@ -59,6 +59,12 @@
|
||||
is(input.accessKey, (MAC ? "⌃⌥i" : "Alt+Shift+i"),
|
||||
"Wrong accessKey on input");
|
||||
|
||||
// Test accessKey on HTML element inside shadow DOM.
|
||||
let shadowButton = getAccessible(
|
||||
document.getElementById("buttonShadow").shadowRoot.firstElementChild);
|
||||
is(shadowButton.accessKey, (MAC ? "⌃⌥t" : "Alt+Shift+t"),
|
||||
"Wrong accessKey on shadow button");
|
||||
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new openMenu("menu", "menuitem"));
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
@ -87,6 +93,17 @@
|
||||
<label control="input" accesskey="i">input</label>
|
||||
<html:input id="input"/>
|
||||
|
||||
<html:div id="buttonShadow"/>
|
||||
<script>
|
||||
<![CDATA[
|
||||
let host = document.getElementById("buttonShadow");
|
||||
let shadow = host.attachShadow({mode: "open"});
|
||||
let button = document.createElement("button");
|
||||
button.setAttribute("accesskey", "t");
|
||||
shadow.append(button);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<keyset>
|
||||
<key key="l" modifiers="control" id="key1"/>
|
||||
</keyset>
|
||||
|
Loading…
Reference in New Issue
Block a user