Closed Bug 1869827 Opened 1 year ago Closed 1 year ago

Links in the "Language and Appearance" sub-section of about:preferences don't work as expected

Categories

(Firefox :: Settings UI, defect, P1)

defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox120 --- wontfix
firefox121 --- wontfix
firefox122 --- verified
firefox123 --- verified

People

(Reporter: hjones, Assigned: hjones)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

The "Manage colors" and "Extensions & Themes" links in the "Language and Appearance" section of about:preferences#general either no longer work or link to the wrong place. The "Manage colors" link doesn't link to anything, and the "Extensions & Themes" link goes to about:addons, but doesn't link directly to the "Themes" section. It also always opens a new tab when previously it would just switch the tab if about:addons was already open.

Digging into this a bit, it looks like these listeners are getting removed when Fluent runs, which would explain the unexpected behaviour and make sense in the context of the regressing bug. Before that change, we were waiting for Fluent to run on the relevant fragment before adding the event listeners. The issue can be fixed by changing the code to something like this:

// make the AppearanceChooser init async and wait for pending Fluent mutations before adding listeners
async init() {
  ...
  if (document.hasPendingL10nMutations) {
    await new Promise(r =>
      document.addEventListener("L10nMutationsFinished", r, { once: true })
    );
  }
  // Add event listeners here
  ...
}

It looks like adding event listeners to DOM elements nested in translations is a known limitation of Fluent, so I'm not sure if there's a different way we might want to address this (like by moving the listeners off of the nested elements).

(In reply to Hanna Jones [:hjones] from comment #0)

Nice find and thanks for filing!

It looks like adding event listeners to DOM elements nested in translations is a known limitation of Fluent, so I'm not sure if there's a different way we might want to address this (like by moving the listeners off of the nested elements).

Yes, that last thing. Otherwise, if the browser language changes at runtime, the listeners also stop working. In principle, the calling code should not need to care about the timing of the l10n bits, and accept that it cannot attach listeners directly to these elements - and/or we should fix this as a bug in fluent-DOM (ie make it keep the existing DOM references instead of replacing them, which is why the listeners are going away). I'm fairly sure it's on file but I cannot find it right now. :-(

Set release status flags based on info from the regressing bug 1831259

Summary: LInks in the "Language and Appearance" sub-section of about:preferences don't work as expected → Links in the "Language and Appearance" sub-section of about:preferences don't work as expected

This patch moves the event click event listeners off of the nested DOM elements to a common ancestor.

I was looking around but didn't see related tests - happy to add coverage here or as part of a follow up bug.

Assignee: nobody → hjones
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1831259

Severity: -- → S2
Priority: -- → P1
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c4182d7a809 Fix click listeners for Language and Appearance links in about:preferences r=settings-reviewers,Gijs
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

The patch landed in nightly and beta is affected.
:hjones, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox122 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(hjones)

This patch moves the event click event listeners off of the nested DOM elements to a common ancestor.

I was looking around but didn't see related tests - happy to add coverage here or as part of a follow up bug.

Original Revision: https://phabricator.services.mozilla.com/D196343

Attachment #9370443 - Flags: approval-mozilla-beta?

Uplift Approval Request

  • Code covered by automated testing: no
  • Risk associated with taking this patch: Low
  • Needs manual QE test: yes
  • String changes made/needed: No
  • User impact if declined: Broken links in the Firefox settings
  • Fix verified in Nightly: no
  • Explanation of risk level: Very small patch that can only affect the settings page, JS only,
  • Steps to reproduce for manual QE testing: See comment 0
  • Is Android affected?: no
Flags: qe-verify+
Flags: needinfo?(hjones)
QA Whiteboard: [qa-triaged]

Reproduced the initial issue described in comment 0 using an old affected Nightly build from (2023-12-12), verified that using the latest Nightly build from today (2023-12-28), both "Manage colors" and "Extensions & Themes" links point to the correct place, manage colors menu and about:addons (Themes section).

Attachment #9370443 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Also verified as fixed using latest Beta build 122.0b6 across platforms (Windows 11, macOS 13 and Ubuntu 22.04).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: