Bug 1867044 - Fire name change for xul labels. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D248979
This commit is contained in:
committed by
eisaacson@mozilla.com
parent
cbd46c3767
commit
77a5fc0c85
@@ -1431,9 +1431,9 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
|
||||
}
|
||||
|
||||
// Fire name change and description change events.
|
||||
if (aAttribute == nsGkAtoms::aria_label) {
|
||||
// A valid aria-labelledby would take precedence so an aria-label change
|
||||
// won't change the name.
|
||||
if (aAttribute == nsGkAtoms::aria_label || aAttribute == nsGkAtoms::label) {
|
||||
// A valid aria-labelledby would take precedence over an aria-label or a xul
|
||||
// label attribute. So if that relation exists the name won't change.
|
||||
AssociatedElementsIterator iter(mDoc, elm, nsGkAtoms::aria_labelledby);
|
||||
if (!iter.NextElem()) {
|
||||
mDoc->FireDelayedEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
|
||||
|
||||
@@ -14,6 +14,8 @@ support-files = [
|
||||
|
||||
["browser_menu_and_alerts.js"]
|
||||
|
||||
["browser_tab_name_change.js"]
|
||||
|
||||
["browser_test_A11yUtils_announce.js"]
|
||||
|
||||
["browser_test_caret_move_granularity.js"]
|
||||
|
||||
38
accessible/tests/browser/events/browser_tab_name_change.js
Normal file
38
accessible/tests/browser/events/browser_tab_name_change.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/* 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";
|
||||
|
||||
/* import-globals-from ../../mochitest/role.js */
|
||||
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
|
||||
|
||||
addAccessibleTask(``, async function (browser, _accDoc) {
|
||||
let tabChanged = waitForEvent(
|
||||
EVENT_FOCUS,
|
||||
e => e.accessible.name == "One" && e.accessible.role == ROLE_DOCUMENT
|
||||
);
|
||||
|
||||
// Put new tab in foreground
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab({
|
||||
gBrowser,
|
||||
url: "data:text/html,<title>One</title>",
|
||||
});
|
||||
|
||||
await tabChanged;
|
||||
|
||||
let nameChanged = waitForEvent(
|
||||
EVENT_NAME_CHANGE,
|
||||
e => e.accessible.name == "Two" && e.accessible.role == ROLE_PAGETAB
|
||||
);
|
||||
|
||||
// Change name of background tab
|
||||
BrowserTestUtils.startLoadingURIString(
|
||||
browser,
|
||||
"data:text/html,<title>Two</title>"
|
||||
);
|
||||
|
||||
await nameChanged;
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
Reference in New Issue
Block a user