Windows screen readers must call IAccessible2::attributes for every show or text inserted event in order to determine whether the inserted content is within a live region, since this is only exposed via an object attribute. These attributes include group position attributes: posinset, setsize and level. When thousands of items are being inserted into a container such as a list, these queries can become expensive, even despite some of the information being cached. For IA2, including group position attributes is redundant in most cases, since there is a dedicated IAccessible2::groupPosition property for this purpose. Similarly, Mac code sometimes calls Accessible::Attributes, but it never uses the group position attributes, since it can use Accessible::GroupPosition() instead. That said, I don't know of a case where this is actually a problem in practice on mac. To address this: 1. No longer return group position attributes in Accessible::Attributes. 2. XPCOM clients, including tests and DevTools, still depend on these attributes, so update xpcAccessible::GetAttributes to include them. 3. ATK has no dedicated group position query, so update the ATK code to include these attributes too. 4. On Android, we could call GroupPosition directly, but it's easier to just pass AccAttributes to AccessibleWrap::GetRoleDescription, so include these attributes there too. 5. As an exception, IA2 requires the level attribute for headings, so include them just for roles::HEADING. Differential Revision: https://phabricator.services.mozilla.com/D231653
52 lines
1.7 KiB
JavaScript
52 lines
1.7 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* Test exposure of group position information.
|
|
*/
|
|
addAccessibleTask(
|
|
`
|
|
<ul>
|
|
<li id="li1">li1<ul>
|
|
<li id="li1a">li1a</li>
|
|
</ul></li>
|
|
<li id="li2">li2</li>
|
|
</ul>
|
|
<h2 id="h2">h2</h2>
|
|
<button id="button">button</button>
|
|
`,
|
|
async function testGroupPosition() {
|
|
let attrs = await runPython(`
|
|
global doc
|
|
doc = getDoc()
|
|
return findByDomId(doc, "li1").get_attributes()
|
|
`);
|
|
is(attrs.posinset, "1", "li1 has correct posinset");
|
|
is(attrs.setsize, "2", "li1 has correct setsize");
|
|
is(attrs.level, "1", "li1 has correct level");
|
|
|
|
attrs = await runPython(`findByDomId(doc, "li1a").get_attributes()`);
|
|
is(attrs.posinset, "1", "li1a has correct posinset");
|
|
is(attrs.setsize, "1", "li1a has correct setsize");
|
|
is(attrs.level, "2", "li1a has correct level");
|
|
|
|
attrs = await runPython(`findByDomId(doc, "li2").get_attributes()`);
|
|
is(attrs.posinset, "2", "li2 has correct posinset");
|
|
is(attrs.setsize, "2", "li2 has correct setsize");
|
|
is(attrs.level, "1", "li2 has correct level");
|
|
|
|
attrs = await runPython(`findByDomId(doc, "h2").get_attributes()`);
|
|
ok(!("posinset" in attrs), "h2 doesn't have posinset");
|
|
ok(!("setsize" in attrs), "h2 doesn't have setsize");
|
|
is(attrs.level, "2", "h2 has correct level");
|
|
|
|
attrs = await runPython(`findByDomId(doc, "button").get_attributes()`);
|
|
ok(!("posinset" in attrs), "button doesn't have posinset");
|
|
ok(!("setsize" in attrs), "button doesn't have setsize");
|
|
ok(!("level" in attrs), "h2 doesn't have level");
|
|
}
|
|
);
|