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-12 21:55:25 +00:00
Родитель 370555942c
Коммит f9ae9c43a1
2 изменённых файлов: 12 добавлений и 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,15 @@ 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 && !this.document.getElementById(aadID)) {
this._setAccessibleFocus(this.selectedElement);
}
}
this._openPanel();
if (firstResult.heuristic) {