morgan pushed to branch mullvad-browser-153.1.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser

Commits:

5 changed files:

Changes:

  • browser/base/content/languageNotification.js
    ... ... @@ -46,7 +46,7 @@ window.addEventListener("load", () => {
    46 46
         {
    
    47 47
           "l10n-id": "language-notification-button",
    
    48 48
           callback() {
    
    49
    -        openPreferences("general-language");
    
    49
    +        openPreferences("languages-browser-languages");
    
    50 50
           },
    
    51 51
         },
    
    52 52
       ];
    

  • browser/components/preferences/config/languages.mjs
    ... ... @@ -862,6 +862,7 @@ SettingGroupManager.registerGroups({
    862 862
         inProgress: true,
    
    863 863
         l10nId: "browser-language-heading",
    
    864 864
         headingLevel: 2,
    
    865
    +    subcategory: "browser-languages",
    
    865 866
         iconSrc: "chrome://browser/skin/sidebar/firefox.svg",
    
    866 867
         items: [
    
    867 868
           {
    

  • browser/components/preferences/findInPage.js
    ... ... @@ -72,7 +72,11 @@ var gSearchResultsPane = {
    72 72
           this.searchInput.addEventListener("input", this);
    
    73 73
           window.addEventListener("DOMContentLoaded", () => {
    
    74 74
             this.searchInput.updateComplete.then(() => {
    
    75
    -          this.searchInput.focus();
    
    75
    +          // To avoid a race with `scrollAndHighlight`, we only move the focus
    
    76
    +          // if it remains at the top of the document. tor-browser#43640.
    
    77
    +          if (document.activeElement === document.body) {
    
    78
    +            this.searchInput.focus();
    
    79
    +          }
    
    76 80
             });
    
    77 81
             // Initialize other panes in an idle callback.
    
    78 82
             window.requestIdleCallback(() => this.initializeCategories());
    

  • browser/components/preferences/main.inc.xhtml
    ... ... @@ -65,7 +65,7 @@
    65 65
     <!-- Languages -->
    
    66 66
     <html:setting-group groupid="browserLanguage" data-srd-migrated="" hidden="true" data-category="paneGeneral"></html:setting-group>
    
    67 67
     <html:setting-group groupid="websiteLanguage" data-srd-migrated="" hidden="true" data-category="paneGeneral"></html:setting-group>
    
    68
    -<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true" data-subcategory="language" data-srd-groupid="browserLanguage">
    
    68
    +<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true" data-srd-groupid="browserLanguage">
    
    69 69
       <label><html:h2 data-l10n-id="language-header"/></label>
    
    70 70
     
    
    71 71
       <vbox id="browserLanguagesBox" align="start" hidden="true">
    

  • browser/components/preferences/preferences.js
    ... ... @@ -961,24 +961,28 @@ function scrollAndHighlight(subcategory) {
    961 961
         return;
    
    962 962
       }
    
    963 963
     
    
    964
    -  // We assign a tabindex=-1 to the element so that we can focus it. This allows
    
    965
    -  // us to move screen reader's focus to an arbitrary position on the page.
    
    966
    -  // See tor-browser#41454 and mozilla bug 1799153.
    
    967
    -  const doFocus = () => {
    
    968
    -    elements[0].setAttribute("tabindex", "-1");
    
    969
    -    Services.focus.setFocus(elements[0], Services.focus.FLAG_NOSCROLL);
    
    970
    -    // Immediately remove again now that it has focus.
    
    971
    -    elements[0].removeAttribute("tabindex");
    
    972
    -  };
    
    973
    -  // The element is not always immediately focusable, so we wait until document
    
    974
    -  // load.
    
    975
    -  if (document.readyState === "complete") {
    
    976
    -    doFocus();
    
    964
    +  // We focus the first element that we can focus.
    
    965
    +  // See tor-browser#41454, tor-browser#45195 and mozilla bug 1799153.
    
    966
    +  let focusTarget = elements[0];
    
    967
    +  if (focusTarget.tagName === "setting-group") {
    
    968
    +    focusTarget = focusTarget.fieldsetEl;
    
    969
    +    // Make the heading focusable.
    
    970
    +    focusTarget.focusableHeading = true;
    
    971
    +    focusTarget.updateComplete.then(() => {
    
    972
    +      focusTarget.focusHeading();
    
    973
    +    });
    
    977 974
       } else {
    
    978
    -    // Wait until document load to move focus.
    
    979
    -    // NOTE: This should be called after DOMContentLoaded, where the searchInput
    
    980
    -    // is focused.
    
    981
    -    window.addEventListener("load", doFocus, { once: true });
    
    975
    +    // Try focus directly using the focus method, which can be overridden.
    
    976
    +    focusTarget.focus();
    
    977
    +    if (!focusTarget.contains(document.activeElement)) {
    
    978
    +      // Else, try focus the first focusable target.
    
    979
    +      Services.focus.moveFocus(
    
    980
    +        window,
    
    981
    +        focusTarget,
    
    982
    +        Services.focus.MOVEFOCUS_FIRST,
    
    983
    +        Services.focus.FLAG_NOSCROLL
    
    984
    +      );
    
    985
    +    }
    
    982 986
       }
    
    983 987
     
    
    984 988
       elements[0].scrollIntoView({