mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1911505: Expose highlighted text to Mac a11y. r=morgan,eeejay
We do this via the undocumented AXHighlight attribute, as gleaned from the WebKit and Chromium source code. Differential Revision: https://phabricator.services.mozilla.com/D218513
This commit is contained in:
parent
d0e79f1b8c
commit
69b36e34e7
@ -135,6 +135,12 @@ NSDictionary* StringAttributesFromAccAttributes(AccAttributes* aAttributes,
|
||||
forKey:NSAccessibilityMarkedMisspelledTextAttribute];
|
||||
}
|
||||
}
|
||||
} else if (iter.Name() == nsGkAtoms::mark) {
|
||||
if (auto value = iter.Value<bool>()) {
|
||||
if (*value) {
|
||||
[attrDict setObject:@YES forKey:@"AXHighlight"];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nsAutoString valueStr;
|
||||
iter.ValueAsString(valueStr);
|
||||
|
@ -13,6 +13,7 @@ support-files = [
|
||||
"!/accessible/tests/mochitest/letters.gif",
|
||||
"!/accessible/tests/mochitest/moz.png",
|
||||
]
|
||||
prefs = ["dom.text_fragments.enabled=true"]
|
||||
|
||||
["browser_app.js"]
|
||||
https_first_disabled = true
|
||||
|
@ -163,3 +163,30 @@ addAccessibleTask(
|
||||
is(text, `hello world${kEmbedChar}`, "Unattributed string is correct");
|
||||
}
|
||||
);
|
||||
|
||||
// Test text fragment.
|
||||
addAccessibleTask(
|
||||
`This is a test.`,
|
||||
async (browser, accDoc) => {
|
||||
const macDoc = accDoc.nativeInterface.QueryInterface(
|
||||
Ci.nsIAccessibleMacInterface
|
||||
);
|
||||
const range = macDoc.getParameterizedAttributeValue(
|
||||
"AXTextMarkerRangeForUnorderedTextMarkers",
|
||||
[
|
||||
macDoc.getAttributeValue("AXStartTextMarker"),
|
||||
macDoc.getAttributeValue("AXEndTextMarker"),
|
||||
]
|
||||
);
|
||||
const attributedText = macDoc.getParameterizedAttributeValue(
|
||||
"AXAttributedStringForTextMarkerRange",
|
||||
range
|
||||
);
|
||||
is(attributedText.length, 3);
|
||||
ok(!attributedText[0].AXHighlight);
|
||||
ok(attributedText[1].AXHighlight);
|
||||
is(attributedText[1].string, "test");
|
||||
ok(!attributedText[2].AXHighlight);
|
||||
},
|
||||
{ urlSuffix: "#:~:text=test" }
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user