Bug 1648468 - Part 6 - Resolve a11y focus issue causing a failure in browser_test_focus_urlbar.js. r=adw

The line that adds `suggestedIndex` in the test should also fix bug 1652138.

Differential Revision: https://phabricator.services.mozilla.com/D83244
This commit is contained in:
Harry Twyford 2020-07-11 21:32:19 +00:00
Родитель 2ec05b9282
Коммит ed82a86096
2 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -337,6 +337,9 @@ async function runTipTests() {
),
];
// Ensure the tip appears in the expected position.
matches[1].suggestedIndex = 2;
let provider = new TipTestProvider(matches);
UrlbarProvidersManager.registerProvider(provider);

Просмотреть файл

@ -547,6 +547,18 @@ class UrlbarView {
});
}
// If we update the selected element, a new unique ID is generated for it.
// We need to ensure that aria-activedescendant reflects this new ID.
if (this.selectedElement && !this.oneOffSearchButtons.selectedButton) {
let aadID = this.input.inputField.getAttribute("aria-activedescendant");
if (!aadID) {
Cu.reportError("Selected element but no aria-activedescendant!");
this._setAccessibleFocus(this.selectedElement);
} else if (!this.document.getElementById(aadID)) {
this._setAccessibleFocus(this.selectedElement);
}
}
this._openPanel();
if (firstResult.heuristic) {