Closed Bug 1713500 Opened 4 years ago Closed 3 years ago

Tab context menu fluent strings not added if it's opened on all tabs menu before it's opened on tab browser

Categories

(Firefox :: Tabbed Browser, defect)

Firefox 90
defect

Tracking

()

RESOLVED DUPLICATE of bug 1658103
Tracking Status
firefox-esr78 --- wontfix
firefox88 --- wontfix
firefox89 --- wontfix
firefox90 --- affected

People

(Reporter: aminomancer, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

  • Start firefox
  • Don't right click the tab browser
  • Open the all tabs menu
  • Right click a tab in the all tabs menu

Actual results:

  • Most context menus have no labels due to no fluent attributes

Expected results:

The function that sets up the fluent attributes is bound to a contextmenu event listener targeting the tab browser but not the all tabs menu. Event listeners should be added for the all tabs panel too.

If the FTL inserter function in tabbrowser.js was accessible from the all tabs panel's scope then it would be a lot easier. The function could be changed like this

this.tabContextFTLInserter = () => {
    MozXULElement.insertFTLIfNeeded("browser/tabContextMenu.ftl");
    // Un-lazify the l10n-ids now that the FTL file has been inserted.
    document
        .getElementById("tabContextMenu")
        .querySelectorAll("[data-lazy-l10n-id]")
        .forEach((el) => {
            el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
            el.removeAttribute("data-lazy-l10n-id");
        });
    this.tabContainer.removeEventListener("contextmenu", this.tabContextFTLInserter, true);
    this.tabContainer.removeEventListener("mouseover", this.tabContextFTLInserter);
    this.tabContainer.removeEventListener("focus", this.tabContextFTLInserter, true);
};
this.tabContainer.addEventListener("contextmenu", this.tabContextFTLInserter, true);
this.tabContainer.addEventListener("mouseover", this.tabContextFTLInserter);
this.tabContainer.addEventListener("focus", this.tabContextFTLInserter, true);

and then the tabs panel could set up the same thing and remove the event listeners if it gets initialized first. in browser-allTabsMenu.js...

gTabsPanel = {
    // ...
    init() {
        // ...
        let lazies = document
            .getElementById("tabContextMenu")
            .querySelectorAll("[data-lazy-l10n-id]");
        if (lazies) {
            MozXULElement.insertFTLIfNeeded("browser/tabContextMenu.ftl");
            lazies.forEach((el) => {
                el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
                el.removeAttribute("data-lazy-l10n-id");
            });
            gBrowser.tabContainer.removeEventListener(
                "contextmenu",
                gBrowser.tabContextFTLInserter,
                true
            );
            gBrowser.tabContainer.removeEventListener("mouseover", gBrowser.tabContextFTLInserter);
            gBrowser.tabContainer.removeEventListener(
                "focus",
                gBrowser.tabContextFTLInserter,
                true
            );
        }
    },
};

The Bugbug bot thinks this bug should belong to the 'Core::Disability Access APIs' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Disability Access APIs
Product: Firefox → Core
Component: Disability Access APIs → Tabbed Browser
Product: Core → Firefox

In addition to the str Don't right click the tab browser, it is necessary to Don't mouse over any tabs before right-clicking the tab entry in the lists all tabs.
I can also reproduce on 78esr as well as 90.0a1.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Yeah sorry about that, the title looked like it was gonna be too long

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.