Closed Bug 1738871 Opened 3 years ago Closed 3 years ago

Profiler icon does not have a name if placed in Overflow Menu

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect, P1)

Desktop
All
defect

Tracking

(firefox-esr91 unaffected, firefox93 unaffected, firefox94 unaffected, firefox95 verified, firefox96 verified)

VERIFIED FIXED
96 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox93 --- unaffected
firefox94 --- unaffected
firefox95 --- verified
firefox96 --- verified

People

(Reporter: atrif, Assigned: julienw)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached image profiler

Affected versions

  • 96.0a1 (20211101215926)
  • 95.0b1 (20211101163752)

Affected platforms

  • Windows 10 x64
  • Ubuntu 21.04
  • macOS 10.15

Steps to reproduce

  1. Open Firefox and Customize Menu.
  2. Add Profiler to the Overflow menu.

Expected result

  • Profiler has a name after the icon.

Actual result

  • No name after the profiler icon inside overflow menu.

Regression range

Notes

  • Attached a screenshot.
Has Regression Range: --- → yes
Has STR: --- → yes

I inspected with the browser toolbox, and I think we're doing the right thing in the profiler code, so I'm thinking of a bug in the custom components we're using. Indeed we're using a rarely used feature of this custom components to have this split in 2 buttons, and I believe that the use of this feature in the overflow menu might be broken. I'll look at this closer later today.

Assignee: nobody → felash
Priority: -- → P1

Hey Gijs, I'd appreciate some pointers about this issue. Fluent sets the label after localization. From inspecting the node, I see the label attribute is properly set, but the value isn't reflected inside the component. As a reminder this is a "button-and-view" widget so it's possible this case was missed when this widget type was implemented.

Thanks!

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Julien Wajsberg [:julienw] from comment #2)

Hey Gijs, I'd appreciate some pointers about this issue. Fluent sets the label after localization. From inspecting the node, I see the label attribute is properly set, but the value isn't reflected inside the component. As a reminder this is a "button-and-view" widget so it's possible this case was missed when this widget type was implemented.

Please can you provide more detail? On what node is the label attribute set, and where is it / is it not reflected? What code would you expect to take care of that reflection? I'm afraid I don't have time right now to try to reproduce this myself.

As a complete hunch, at what point in time is the label attribute set, and does the button have a visible label when it is in the customize mode "palette" (not put in any of the toolbars) ? Is it possible we're not synchronizing to the title attribute of the toolbarpaletteitem, or something?

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(felash)

Just want to point out that regression range pushlog contained two bugs and maybe this is not the correct regressor that I assumed it is.

(In reply to Alexandru Trif, QA [:atrif] from comment #4)

Just want to point out that regression range pushlog contained two bugs and maybe this is not the correct regressor that I assumed it is.

Yes, this is likely the right one :-) Thanks for finding the regression range in the first place!

(In reply to :Gijs (he/him) from comment #3)

(In reply to Julien Wajsberg [:julienw] from comment #2)

Hey Gijs, I'd appreciate some pointers about this issue. Fluent sets the label after localization. From inspecting the node, I see the label attribute is properly set, but the value isn't reflected inside the component. As a reminder this is a "button-and-view" widget so it's possible this case was missed when this widget type was implemented.

Please can you provide more detail? On what node is the label attribute set, and where is it / is it not reflected? What code would you expect to take care of that reflection? I'm afraid I don't have time right now to try to reproduce this myself.

I'll detail what I've seen when inspecting with the Browser Toolbox.

For other buttons, this looks like this (simplified):

<toolbarbutton data-l10n-id="navbar-downloads" removable="true" overflows="false" tooltip="dynamic-shortcut-tooltip" indicator="true" label="Downloads" cui-areatype="menu-panel" cui-anchorid="nav-bar-overflow-button" context="customizationPanelItemContextMenu">
  <stack class="toolbarbutton-badge-stack">...</stack>
  <label class="toolbarbutton-text" crop="right" flex="1" value="Downloads"/>
</toolbarbutton>

We see that the toolbarbutton's label atribute is properly copied to the label's value attribute.

For the profiler button, this looks like this (simplified):

<toolbaritem id="profiler-button" widget-id="profiler-button" widget-type="button-and-view" removable="true" overflows="true" data-l10n-id="profiler-popup-button-idle" label="Profiler" tooltiptext="Record a performance profile" cui-areatype="menu-panel" cui-anchorid="nav-bar-overflow-button" context="customizationPanelItemContextMenu">
  <toolbarbutton class="toolbarbutton-1 subviewbutton-nav" id="profiler-button-button">
    <image class="toolbarbutton-icon"/>
    <label class="toolbarbutton-text" crop="right" flex="1"/>
  </toolbarbutton>
  <toolbarbutton id="profiler-button-dropmarker" class="toolbarbutton-1 toolbarbutton-combined-buttons-dropmarker">...</toolbarbutton></toolbaritem>

Here we see that the toolbaritem's label atribute isn't properly copied to the toolbarbutton's label attribute, and as a result to the label's value attribute.

As a reference, this is what I see in beta:

<toolbaritem id="profiler-button" widget-id="profiler-button" widget-type="button-and-view" removable="true" overflows="true" label="Profiler" tooltiptext="Record a performance profile" context="customizationPanelItemContextMenu" cui-areatype="menu-panel" cui-anchorid="nav-bar-overflow-button">
  <toolbarbutton class="toolbarbutton-1 subviewbutton-nav" id="profiler-button-button" label="Profiler" tooltiptext="Record a performance profile">
    <image class="toolbarbutton-icon" label="Profiler"/>
    <label class="toolbarbutton-text" crop="right" flex="1" value="Profiler"/>
  </toolbarbutton>
  <toolbarbutton id="profiler-button-dropmarker" class="toolbarbutton-1 toolbarbutton-combined-buttons-dropmarker">...</toolbarbutton>
</toolbaritem>

Here the inner toolbarbutton inherits properly all values and as a result the inner label too.

The difference is that now we use Fluent (with the l10nId property when configuring the widget), but before we were using the l10n properties.

As a complete hunch, at what point in time is the label attribute set,

I believe it's set by the Fluent library after data-l10n-id is set and the element added to the DOM.

and does the button have a visible label when it is in the customize mode "palette" (not put in any of the toolbars) ?

Yes

Is it possible we're not synchronizing to the title attribute of the toolbarpaletteitem, or something?

I believe this is a synchronization issue indeed :-)

I think I mostly need pointers to the implementation of toolbaritem (especially) and toolbarbutton, I can't find where these custom components are defined and implemented. Then I can probably fix the problem myself :-)

Thanks!

Flags: needinfo?(felash)
Flags: needinfo?(gijskruitbosch+bugs)

The attribute handling for toolbar buttons is at https://searchfox.org/mozilla-central/rev/88cd13997fb0747cdcd78638fc762ff2d75e1fc5/toolkit/content/widgets/toolbarbutton.js#97-111,113-114,117-119 .

There is no implementation part for toolbaritem; it's meant to just be a container without any logic. Probably the data-l10n-id should (also?) be set on the button directly.

Flags: needinfo?(gijskruitbosch+bugs)

I see, thanks for the comment. I was looking for some special handling of toolbaritem but couldn't find it, but now I see this is in toolbarbutton instead.

In the "old way", there is indeed a special handling:

        node.setAttribute("label", this.getLocalizedProperty(aWidget, "label"));
        if (button != node) {
          button.setAttribute("label", node.getAttribute("label"));
        }

button is different than node in the case of button-with-view. In this case we add the label for both nodes.
Same thing goes for the tooltip.

But we don't have such a special handling for the l10nId option.

I'm trying to add this.
I'll add this. Thanks for the pointers!

Blocks: 1697420
Pushed by jwajsberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f7f1cc665cce
[CustomizableUI] Support the button-and-view custom widget type in the overflow menu when Fluent is used r=Gijs
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch

Julien, do you want to request an uplift to beta or should this patch ship in 96? Thanks

Flags: needinfo?(felash)

Verified fixed with 96.0a1 (20211109093712) on Windows 10x64, macOS 10.15 and Ubuntu 21.04. The Profiler icon has now a name when placed inside Customize Menu.

Comment on attachment 9249240 [details]
Bug 1738871 - [CustomizableUI] Support the button-and-view custom widget type in the overflow menu when Fluent is used r=gijs

Beta/Release Uplift Approval Request

  • User impact if declined: No label when the profiler icon is in the overflow menu
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): We're adding a new attribute and not removing anything, therefore this is low risk.
  • String changes made/needed: none, this is reusing a previous string
Flags: needinfo?(felash)
Attachment #9249240 - Flags: approval-mozilla-beta?

Comment on attachment 9249240 [details]
Bug 1738871 - [CustomizableUI] Support the button-and-view custom widget type in the overflow menu when Fluent is used r=gijs

Low risk, approved for 95 beta 6, thanks.

Attachment #9249240 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Profiler name is correctly displayed with Firefox 95.0b6 on Windows 10x64, macOS 10.15 and Ubuntu 21.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: