This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 03b200a1d40158a22750a6d335c4bebbdb0834d8 Author: Henry Wilkes henry@torproject.org AuthorDate: Tue Nov 15 11:48:04 2022 +0000
Bug 41454: Move focus after calling openPreferences for a sub-category.
Temporary fix until mozilla bug 1799153 gets a patch upstream. --- browser/components/preferences/preferences.js | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js index 5f327eacf513..7aeb97f6a895 100644 --- a/browser/components/preferences/preferences.js +++ b/browser/components/preferences/preferences.js @@ -466,6 +466,17 @@ async function scrollAndHighlight(subcategory, category) { } let header = getClosestDisplayedHeader(element);
+ // We assign a tabindex=-1 to the element so that we can focus it. This allows + // us to move screen reader's focus to an arbitrary position on the page. + // See tor-browser#41454 and bug 1799153. + element.setAttribute("tabindex", "-1"); + // The element is not always immediately focusable, so we wait until the next + // loop. + setTimeout(() => { + Services.focus.setFocus(element, Services.focus.FLAG_NOSCROLL); + element.removeAttribute("tabindex"); + }); + scrollContentTo(header); element.classList.add("spotlight"); }