Closed Bug 2003045 Opened 7 months ago Closed 5 months ago

[Ubuntu 24.04LTS GNOME 46] Misplaced popups (Dev Tools Console Settings, context-menu) sometimes appear at top-left window corner

Categories

(Core :: Widget: Gtk, defect, P3)

Firefox 147
defect

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox145 --- unaffected
firefox146 --- unaffected
firefox147 --- fixed
firefox148 --- fixed
firefox149 --- fixed

People

(Reporter: erosman, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(12 files)

Subsequent to bug 1999123, there are other instances of misplaced popups. e.g. the Dev Tools Console Settings popup and the context-menu popup.

STR

  • Open the Dev Tools (F12)
  • Go to the Console Tab
  • Click on the cogwheel icon (top right)

AFA the context-menu, it is sporadic. I noticed it when right-clicking links, images but there is no definite pattern for STR.

Note: the Dev Tools Settings popup misplacement only happens when Firefox is maximised.

Ubuntu 24.04 Wayland
Nightly

Attached image bug2003045-a.png
Attached image bug2003045-b.png
See Also: → 1999123
Flags: needinfo?(stransky)
Attached image bug2003045-c.png

Dev Tools -> Inspector -> mouse-over item with a popup (e.g. var(--step-3))

Not sure I can reproduce on Gnome 49. The cogwheel icon popup uses negative margin so we position it wrongly with move-to-rect but I don't see the 0,0 position but rather x-200 one.

Can you try to get MOZ_LOG="Widget:5 WidgetPopup:5" ./firefox > log.txt 2>&1 log for any of the misplaced popups?
Thanks.

Flags: needinfo?(stransky) → needinfo?(eros_uk)
Priority: -- → P3

Can you try to get MOZ_LOG="Widget:5 WidgetPopup:5" ./firefox > log.txt 2>&1 log for any of the misplaced popups?

I have done this before and I did it again, but all I get in the log is:

[18579] Sandbox: CanCreateUserNamespace() unshare(CLONE_NEWPID): EPERM

Note: the Dev Tools Settings popup misplacement only happens when Firefox is maximised.

Flags: needinfo?(eros_uk)
Attached image bug2003045-d.png

Also in: Firefox 145.0.2 build ID 20251125000153, maximised

Attached image bug2003045-e.png

Firefox 145.0.2 build ID 20251125000153, not-maximised

I suspect it's due to negative margin - will check it.

Flags: needinfo?(stransky)

I see the same bug on 145.0.2.

Looks like it's due to flip_x used there:

[Parent 86908: Main Thread]: D/WidgetPopup [7f0385d0ad00]:   Anchor rect [1712, 655] -> [1 x 1]
...
[Parent 86908: Main Thread]: D/WidgetPopup [7f0385d0ad00] NativeMoveResizeCallback flipped_x 1 flipped_y 0
[Parent 86908: Main Thread]: D/WidgetPopup [7f0385d0ad00]    new position [1474, 646] -> [228 x 176]

I wonder if we can check the popup type and disable flip if popup has the visible anchor. Emilio, do you know if we can check that?
Thanks.

Flags: needinfo?(stransky) → needinfo?(emilio)

Well, yes, and no. Doing that would be counter-productive for most other popups, right? Even if the anchor is visible the popup might not (think putting an extension window at the left of the toolbar).

The main issue is that these DevTools popups don't use the usual <menupopup> styling so we believe the shadow is part of the popup's content that may be visible...

But also the position shouldn't end up at 0,0? I can't reproduce this on KDE...

Flags: needinfo?(emilio)
Severity: -- → S3

The displaced devtools popups when overflowing is already covered by Bug 1823249.

The (0,0) popup placement is a new regression that affects Ubuntu 24.04LTS (GNOME 46) but not Ubuntu 25.10 (GNOME 49) (single display).
At 100%, 175% and 200% scale, overflowing devtool popups consistently appear at (0,0).
At 125% and 150% scale, popups only flash briefly at (0,0) before correcting.

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=f84254926bdf6d2506f6577156f9e7804fc9de38&tochange=cd20a71d574690e3162d9368225defce3ff06969

Regressed by Bug 1998382.

Keywords: regression
Regressed by: 1998382
See Also: → 1823249
Summary: Misplaced popups (Dev Tools Console Settings, context-menu) sometimes appear at top-left window corner → [Ubuntu 24.04LTS GNOME 46] Misplaced popups (Dev Tools Console Settings, context-menu) sometimes appear at top-left window corner
Version: unspecified → Firefox 147

Kestrel, can you please run the case when popup is placed at 0,0 persistently with MOZ_LOG="Widget:5,WidgetPopup:5" WAYLAND_DEBUG=1 variables and attach the log here?

From the widget log only it looks like we place the popup correctly (somehow) according to what compositor gives us.

Flags: needinfo?(ke5trel)
Flags: needinfo?(ke5trel)

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

Flags: needinfo?(stransky)

If that's Gnome 46 compositor bug (perhaps wrong interaction between xdg-popup and persistent wl_surface) which leads to persistent 0,0 popup placement we can detect such case and use plain move to original coordinates (direct placement) or place the popup inside of toplevel window.

Hm, is the log really for the popup shown at 0,0? Because the says it's shown at 1408, 706:

[2041279.057] xdg_popup@92.configure(1408, 706, 233, 173)
[Parent 208245: Main Thread]: D/WidgetPopup [7c6f3a019600] NativeMoveResizeCallback flipped_x 1 flipped_y 1
[Parent 208245: Main Thread]: D/WidgetPopup [7c6f3a019600]    new position [1408, 706] -> [233 x 173]
[2041279.119] xdg_surface@91.configure(6751)

so compositor says it's displayed at [1408, 706] but actually rendered at 0,0. If that's already fixed in Gnome 49 we shall ask Ubuntu to backport the compositor fix to Mutter 46 then.

Flags: needinfo?(stransky)

Easily encountered by right-clicking near bottom screen edge where the context menu flips above the cursor. Despite the menu appearing at (0,0), it is still interactive in its original expected location. Submenus appear in their correct location.

The black box in the recording is transparent and has a hall of mirrors effect when the cursor passes over it.

I think widget.wayland.use-move-to-rect set to false fixes it, right?
Thanks.

Flags: needinfo?(ke5trel)

It does not happen with widget.wayland.use-move-to-rect = false.

Flags: needinfo?(ke5trel)
Attached image vertical tab preview

Reproduced when hovering the bottom tabs when they are vertical and overflow. Mozregression pointed out to bug 1998382.

Hi Martin, what's our path forward on this bug?

Flags: needinfo?(stransky)

Will check that on actual Ubuntu 24.04LTS. We have only this report so doesn't look much wide-spread? Or may be affect only specific line?
Anyway, the best solution is to persuade ubuntu folks to update mutter to fixed/working version. Or we can use widget.wayland.use-move-to-rect=false there (with some plumbing & boundaries updates) but there's a problem to detect the environment correctly - can we check we're running Ubuntu 24.04LTS?

Okay, testes on Ubuntu 24.04LTS. From the testing it looks like when wl_surface is created & used with xdg_popup and then the save surface is used with wl_subsurface we see the misplacement here.

So if we use xdg_popup with popup we need to keep that method and don't switch to subsurfaces for it.
So this is a generally a regression from Bug 1975969 revealed by Bug 1998382 (but still Mutter 46 only bug).

I think we just need to keep mPopupUseMoveToRect true if that's set once.

We may also add alway-use-move-to-rect option for testing such cases.

Assignee: nobody → stransky
Status: NEW → ASSIGNED

We should backport it to beta.

Flags: needinfo?(stransky)
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch

(In reply to Martin Stránský [:stransky] (ni? me) from comment #31)

We should backport it to beta.

Please add a beta uplift request when ready.
It might be too late for release, but please consider adding a request just in case.

Flags: needinfo?(stransky)
Duplicate of this bug: 2012283

Comment on attachment 9539731 [details]
Bug 2003045 [Wayland] Don't switch between xdg_popup and wl_subsurface popups r?emilio

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: popup windows may be misplaced on Wayland
  • 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): Disable popup placement optimization we introduced in Bug 1975969.
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(stransky)
Attachment #9539731 - Flags: approval-mozilla-release?
Attachment #9539731 - Flags: approval-mozilla-beta?
Duplicate of this bug: 2012332

Comment on attachment 9539731 [details]
Bug 2003045 [Wayland] Don't switch between xdg_popup and wl_subsurface popups r?emilio

Approved for 148.0b8

Attachment #9539731 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Duplicate of this bug: 2012238

Comment on attachment 9539731 [details]
Bug 2003045 [Wayland] Don't switch between xdg_popup and wl_subsurface popups r?emilio

Approved for 147.0.3

Attachment #9539731 - Flags: approval-mozilla-release? → approval-mozilla-release+
QA Whiteboard: [qa-ver-needed-c149/b148]
Flags: qe-verify+

I could still reproduce the issue with Firefox 147.0.3, 148 beta 10 and latest Nightly 149.0a1 2026-02-02 under Ubuntu 24 Wayland.

All the issues mentioned in this bug and in the duplicates (context menu position, tab hover preview, developer tools, console settings) are still reproducible.
It might not occur as often, but once hit, the wrong popup position will persist longer and for several trigger points.

Example: the tab hover preview that I pointed out in comment 24 was only shown for the bottom tabs (2 or 3). Now, once hit, the preview will be shown in top left corner for all the tabs (please see the attached video).

Flags: needinfo?(stransky)

(In reply to Petruta Horea [:phorea] from comment #43)

Created attachment 9542300 [details]
147.0.3 wayland popups.mp4

I could still reproduce the issue with Firefox 147.0.3, 148 beta 10 and latest Nightly 149.0a1 2026-02-02 under Ubuntu 24 Wayland.

All the issues mentioned in this bug and in the duplicates (context menu position, tab hover preview, developer tools, console settings) are still reproducible.
It might not occur as often, but once hit, the wrong popup position will persist longer and for several trigger points.

Example: the tab hover preview that I pointed out in comment 24 was only shown for the bottom tabs (2 or 3). Now, once hit, the preview will be shown in top left corner for all the tabs (please see the attached video).

Please file a new bug for it. Do you have any exact reproduction steps?
Thanks.

Flags: needinfo?(stransky) → needinfo?(phorea)
Blocks: 2014419

Thank you! I filled bug 2014419.
There are no exact reproduction steps, I just clicked around to see if the issue was fixed and I encountered it again pretty easily, with both new or used Firefox profiles.

Flags: needinfo?(phorea)
QA Contact: phorea
QA Whiteboard: [qa-ver-needed-c149/b148] → [qa-ver-done-c149/b148]
Flags: qe-verify+
Duplicate of this bug: 2001910
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: