mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1790435: Don't apply rotor post-filter if AXSearchText is empty r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D160836
This commit is contained in:
parent
6efb8ce4cf
commit
5318c8b0a3
@ -123,7 +123,9 @@ using namespace mozilla::a11y;
|
||||
|
||||
- (BOOL)shouldApplyPostFilter {
|
||||
// We currently only support AXSearchText as a post-search filter.
|
||||
return !!mSearchText;
|
||||
// In some cases, VO passes a non-null, empty string for AXSearchText.
|
||||
// In that case, we should act as if no AXSearchText was given.
|
||||
return !!mSearchText && [mSearchText length] > 0;
|
||||
}
|
||||
|
||||
- (NSArray<mozAccessible*>*)applyPostFilter:(NSArray<mozAccessible*>*)matches {
|
||||
|
@ -58,6 +58,54 @@ addAccessibleTask(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test rotor with heading and empty search text
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<h1 id="hello">hello</h1><br><h2 id="world">world</h2><br>goodbye`,
|
||||
async (browser, accDoc) => {
|
||||
const searchPred = {
|
||||
AXSearchKey: "AXHeadingSearchKey",
|
||||
AXImmediateDescendantsOnly: 1,
|
||||
AXResultsLimit: -1,
|
||||
AXDirection: "AXDirectionNext",
|
||||
AXSearchText: "",
|
||||
};
|
||||
|
||||
const webArea = accDoc.nativeInterface.QueryInterface(
|
||||
Ci.nsIAccessibleMacInterface
|
||||
);
|
||||
is(
|
||||
webArea.getAttributeValue("AXRole"),
|
||||
"AXWebArea",
|
||||
"Got web area accessible"
|
||||
);
|
||||
|
||||
const headingCount = webArea.getParameterizedAttributeValue(
|
||||
"AXUIElementCountForSearchPredicate",
|
||||
NSDictionary(searchPred)
|
||||
);
|
||||
is(headingCount, 2, "Found two headings");
|
||||
|
||||
const headings = webArea.getParameterizedAttributeValue(
|
||||
"AXUIElementsForSearchPredicate",
|
||||
NSDictionary(searchPred)
|
||||
);
|
||||
const hello = getNativeInterface(accDoc, "hello");
|
||||
const world = getNativeInterface(accDoc, "world");
|
||||
is(
|
||||
headings[0].getAttributeValue("AXTitle"),
|
||||
hello.getAttributeValue("AXTitle"),
|
||||
"Found correct first heading"
|
||||
);
|
||||
is(
|
||||
headings[1].getAttributeValue("AXTitle"),
|
||||
world.getAttributeValue("AXTitle"),
|
||||
"Found correct second heading"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test rotor with articles
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user