mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1841216: Fire a11y description change event when aria-description is changed. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D182544
This commit is contained in:
parent
0266d92dba
commit
e343609eb8
@ -1340,6 +1340,17 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_description) {
|
||||
// A valid aria-describedby would take precedence so an aria-description
|
||||
// change won't change the description.
|
||||
IDRefsIterator iter(mDoc, elm, nsGkAtoms::aria_describedby);
|
||||
if (!iter.NextElem()) {
|
||||
mDoc->FireDelayedEvent(nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE,
|
||||
this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_describedby) {
|
||||
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
|
||||
mDoc->FireDelayedEvent(nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE, this);
|
||||
|
@ -251,3 +251,30 @@ addAccessibleTask(
|
||||
},
|
||||
{ chrome: true, topLevel: true, iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
||||
/**
|
||||
* Test aria-description, including mutations.
|
||||
*/
|
||||
addAccessibleTask(
|
||||
`<button id="button" aria-description="a">button</button>`,
|
||||
async function (browser, docAcc) {
|
||||
const button = findAccessibleChildByID(docAcc, "button");
|
||||
testDescr(button, "a");
|
||||
info("Changing aria-description");
|
||||
let changed = waitForEvent(EVENT_DESCRIPTION_CHANGE, button);
|
||||
await invokeSetAttribute(browser, "button", "aria-description", "b");
|
||||
await changed;
|
||||
testDescr(button, "b");
|
||||
info("Removing aria-description");
|
||||
changed = waitForEvent(EVENT_DESCRIPTION_CHANGE, button);
|
||||
await invokeSetAttribute(browser, "button", "aria-description");
|
||||
await changed;
|
||||
testDescr(button, "");
|
||||
info("Setting aria-description");
|
||||
changed = waitForEvent(EVENT_DESCRIPTION_CHANGE, button);
|
||||
await invokeSetAttribute(browser, "button", "aria-description", "c");
|
||||
await changed;
|
||||
testDescr(button, "c");
|
||||
},
|
||||
{ chrome: true, topLevel: true, iframe: true, remoteIframe: true }
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user