morgan pushed to branch mullvad-browser-153.1.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser Commits: 54a1eb5f by Henry Wilkes at 2026-08-24T13:26:00+00:00 fixup! BB 41369: Improve Firefox language settings for multi-lingual packages BB 45195: Change the subcategory for the language notification. - - - - - 89ccd3f3 by Henry Wilkes at 2026-08-24T13:26:00+00:00 fixup! BB 41454: Move focus after calling openPreferences for a sub-category. BB 43640: Modify the focus handling to work with the new settings redesign. - - - - - 5 changed files: - browser/base/content/languageNotification.js - browser/components/preferences/config/languages.mjs - browser/components/preferences/findInPage.js - browser/components/preferences/main.inc.xhtml - browser/components/preferences/preferences.js Changes: ===================================== browser/base/content/languageNotification.js ===================================== @@ -46,7 +46,7 @@ window.addEventListener("load", () => { { "l10n-id": "language-notification-button", callback() { - openPreferences("general-language"); + openPreferences("languages-browser-languages"); }, }, ]; ===================================== browser/components/preferences/config/languages.mjs ===================================== @@ -862,6 +862,7 @@ SettingGroupManager.registerGroups({ inProgress: true, l10nId: "browser-language-heading", headingLevel: 2, + subcategory: "browser-languages", iconSrc: "chrome://browser/skin/sidebar/firefox.svg", items: [ { ===================================== browser/components/preferences/findInPage.js ===================================== @@ -72,7 +72,11 @@ var gSearchResultsPane = { this.searchInput.addEventListener("input", this); window.addEventListener("DOMContentLoaded", () => { this.searchInput.updateComplete.then(() => { - this.searchInput.focus(); + // To avoid a race with `scrollAndHighlight`, we only move the focus + // if it remains at the top of the document. tor-browser#43640. + if (document.activeElement === document.body) { + this.searchInput.focus(); + } }); // Initialize other panes in an idle callback. window.requestIdleCallback(() => this.initializeCategories()); ===================================== browser/components/preferences/main.inc.xhtml ===================================== @@ -65,7 +65,7 @@ <!-- Languages --> <html:setting-group groupid="browserLanguage" data-srd-migrated="" hidden="true" data-category="paneGeneral"></html:setting-group> <html:setting-group groupid="websiteLanguage" data-srd-migrated="" hidden="true" data-category="paneGeneral"></html:setting-group> -<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true" data-subcategory="language" data-srd-groupid="browserLanguage"> +<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true" data-srd-groupid="browserLanguage"> <label><html:h2 data-l10n-id="language-header"/></label> <vbox id="browserLanguagesBox" align="start" hidden="true"> ===================================== browser/components/preferences/preferences.js ===================================== @@ -961,24 +961,28 @@ function scrollAndHighlight(subcategory) { return; } - // 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 mozilla bug 1799153. - const doFocus = () => { - elements[0].setAttribute("tabindex", "-1"); - Services.focus.setFocus(elements[0], Services.focus.FLAG_NOSCROLL); - // Immediately remove again now that it has focus. - elements[0].removeAttribute("tabindex"); - }; - // The element is not always immediately focusable, so we wait until document - // load. - if (document.readyState === "complete") { - doFocus(); + // We focus the first element that we can focus. + // See tor-browser#41454, tor-browser#45195 and mozilla bug 1799153. + let focusTarget = elements[0]; + if (focusTarget.tagName === "setting-group") { + focusTarget = focusTarget.fieldsetEl; + // Make the heading focusable. + focusTarget.focusableHeading = true; + focusTarget.updateComplete.then(() => { + focusTarget.focusHeading(); + }); } else { - // Wait until document load to move focus. - // NOTE: This should be called after DOMContentLoaded, where the searchInput - // is focused. - window.addEventListener("load", doFocus, { once: true }); + // Try focus directly using the focus method, which can be overridden. + focusTarget.focus(); + if (!focusTarget.contains(document.activeElement)) { + // Else, try focus the first focusable target. + Services.focus.moveFocus( + window, + focusTarget, + Services.focus.MOVEFOCUS_FIRST, + Services.focus.FLAG_NOSCROLL + ); + } } elements[0].scrollIntoView({ View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/ffe... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/ffe... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
morgan (@morgan)