[KDE/Wayland] Nested folders drop down in wrong position on scaled monitor
Categories
(Core :: Widget: Gtk, defect, P3)
Tracking
()
People
(Reporter: madness742, Unassigned)
References
(Blocks 2 open bugs)
Details
Attachments
(8 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0
Steps to reproduce:
(This bug can also be reproduced on Nightly 147.0a1 - 2025-12-07)
Monitor setup:
- Primary monitor (2560x1440, 100% scaling).
- Secondary monitor (2160x3840, 150% scaling).
- Create a folder in Bookmarks Toolbar.
- Create another folder, within the newly created folder.
- Populate that folder with a couple bookmarks.
- Move Firefox to the second monitor. (150% scaling)
- Open the nested folder.
Actual results:
The position of the drop down menu is in the wrong position, when following the steps on the scaled monitor.
Expected results:
It should behave like the non-scaled monitor.
| Reporter | ||
Updated•9 months ago
|
Comment 1•9 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•9 months ago
|
Comment 2•9 months ago
|
||
Please check bug 2005152. Is it what happened to you?
| Reporter | ||
Comment 3•9 months ago
|
||
It does seem related, but he's encountering it on a single monitor with 100% scaling. I can only reproduce this issue on a scaled monitor. I also don't need to nest the folders as much as him for this bug to occur.
The drop down menu also isn't out of the screen, unless I don't maximize Firefox.
Under about:support, my secondary monitor reports the wrong resolution and scaling.
Display0 2880x5120@60Hz scales:2.000000|2.000000 <-- Secondary monitor
Display1 2560x1440@144Hz scales:1.000000|1.000000 <-- Primary monitor
| Reporter | ||
Comment 4•9 months ago
|
||
Comment 5•9 months ago
|
||
Can you please create a screen cast of it?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Create_screenshot/screencast_for_a_bug_report
Thanks.
| Reporter | ||
Comment 6•9 months ago
|
||
Comment 7•9 months ago
|
||
Do you ever try to switch the arrangement of two screens (left<->right)?
Comment 8•9 months ago
•
|
||
Could you provide the log generated by firefox with the following command?
env MOZ_LOG="timestamp,WidgetPopup:5" MOZ_LOG_FILE="popup" firefox
Attach the file popup.moz_log there.
Please keep the test as short as possible, just enough to reproduce the issue.
| Reporter | ||
Comment 9•9 months ago
|
||
(In reply to Thinker Li [:sinker] from comment #7)
Do you ever try to switch the arrangement of two screens (left<->right)?
It makes no difference if I place the left monitor, right of the primary monitor.
(In reply to Thinker Li [:sinker] from comment #8)
Could you provide the log generated by firefox with the following command?
I'll attach the log file, but I wasn't able to get it working on the Flatpak build. So instead I used Nightly 148.0a1 (2025-12-13).
| Reporter | ||
Comment 10•9 months ago
|
||
The window initially started on my primary monitor. I moved it to the second monitor, clicked on "Other Bookmarks", selected the first bookmark folder (correct position), moved the cursor to the second bookmark folder (bugged position), hit escape twice in a row and closed Firefox.
Comment 11•9 months ago
|
||
That depeneds on compositor how is the window placed. It's not managed by Firefox itself. I suggest to file a bug against KDE/Kwin.
| Reporter | ||
Comment 12•9 months ago
|
||
I've reported it on the KDE bug tracker: https://bugs.kde.org/show_bug.cgi?id=513398
| Reporter | ||
Comment 13•9 months ago
|
||
The KDE developers are saying that there's no bug on their side, and I've confirmed this by being able to reproduce it on Fedora 43 Workstation (GNOME 49).
Comment 14•9 months ago
•
|
||
In the log provided by comment #10, the menu of the second bookmark folder is placed at the right side of the folder item at beginning and moved to a buggy position immediately. Checking the video in comment #6, you can see the buggy menus are placed at the left of the item (not right), then move to a buggy position. It matches what I observed in the log. So, that means Firefox made the movement.
I think it is the compositor placing menu at the left of the item, not right. I guess the reason placing at left is that Firefox place the menu out of the visible area (according to the log) of the screen and the compositor adjust it position according to the anchor rect and the gravity.
nsWindow::Resize [1450.67,196.00] -> [537.33 x 452.00] scaled [1451,196] -> [537 x 452] repaint 1
If I am right, the size of the logic screen of Wayland is 1440 x 2560. [1450.67,1960.00] above is invisible.
Somehow, 20~40ms later, it moves the menu left to a buggy position twice. At this moment, the menu is visible, and the compositor doesn't adjust it's position.
nsWindow::Move to [784 x 196] scale 1.500000 scaled [1176.00 x 294.00]
nsWindow::Move to [915 x 199] scale 1.500000 scaled [1372.50 x 298.50]
In the video of comment #6, KDE also has some weird behavior. For example, sometime it allow to extend the menu to the right screen (primary screen), but sometime it doesn't allow.
Other evidences are log messages of layout popup CSS anchor. They show the CSS of the popup frame has been changed 4 times for reasons unknown yet.
I guess always placing menus in visible positions of the current screen can avoid this unpredictable behavior.
Comment 15•9 months ago
•
|
||
Thank you for the log in the comment #10!
Could you capture your desktop and the log while doing test?
I would like to match the positions in the log match what is on the screen.
Please use the following command. Thanks!
env MOZ_LOG="timestamp,WidgetPopup:5,WidgetScreen:5" MOZ_LOG_FILE="popup" firefox
| Reporter | ||
Comment 16•9 months ago
|
||
I had to downgrade my Nightly version to 2025-12-13-09-12-41 in order to reproduce the problem.
In Nightly 2025-12-17, nested folders with bookmarks appear in the correct position, but not empty nested folders on the scaled monitor.
There's also a slight blur when opening "Other Bookmarks" on the scaled monitor, and after one second it looks sharp. This can also be seen in the context menu when right clicking on a page, or when hovering over a different nested folder. These blur issues are not present on the primary (non-scaled) monitor. Changing scaling on the primary monitor for 100% to 150% makes me able to reproduce the blur issue.
| Reporter | ||
Comment 17•9 months ago
|
||
| Reporter | ||
Comment 18•9 months ago
|
||
Comment 19•9 months ago
•
|
||
In Nightly 2025-12-17, nested folders with bookmarks appear in the correct position, but not empty nested folders on the scaled monitor. Do you mean empty nested folders are still buggy? Or not?
| Reporter | ||
Comment 20•9 months ago
|
||
The empty nested folders are still buggy, I'll attach a video of the problem.
| Reporter | ||
Comment 21•9 months ago
|
||
Comment 22•9 months ago
•
|
||
Summary of my investigation.
When a menu is out of the visible region of the screen, the compositor moves it to the other side of the parent menu from right to left. It causes side-effects. A "move-to-rect" callback NativeMoveResizeCallback() is called. The callback eventually calls nsMenuPopupFrame::MoveTo(). The following is some facts of nsMenuPopupFrame.
- The value of
mAnchorTypeisMenuPopupAnchorType::Nodeat beginning MoveTo()changes the value ofmAnchorTypetoMenuPopupAnchorType::PointifmAnchorTypeis notMenuPopupAnchorType::Rectwhen enter the function.MoveTo()movesmScreenRectto the top-left of the currentnsMenuPopupFrame.MoveTo()callsGetRects()indirectly throughSetPopupPosition(), andGetRects()compute the value ofnsMenuPopupFrame::mUntransformedAnchorRect(keeping inresult.mUntransformedAnchorRectfor temporary). It's value will be at the top-left corner of menu popup before moving the position if mAnchorType isMenuPopupAnchorType::Point(IsAnchored()).mUntransformedAnchorRectis passed togdk_window_move_to_rect(). The compositor will make sure the popup is overlaid with the rect.MoveTo()eventually callgdk_window_move_to_rect()to move the popup to the position given by the compositor although it is not necessary since the compositor had moved it.
The problem is the compositor moves the menu popup to left side of the parent popup. However, the rect mUnstransformedAnchorRect passed to gdk_window_move_to_rect() is at the top-left corner of the popup before moving it. It is at the right side of the parent menu. That means the new position of the menu popup is not overlaid with the rect. So, the compositor will try to move the popup again to make sure the popup cover the rect. It is the buggy position over the parent menu like what we see in the video.
Keeping mUntranformedAnchorRect untouched for this case may fix the issue.
Updated•9 months ago
|
Comment 23•9 months ago
|
||
So when we MoveTo() it's expected to change the anchor rect. I think what's going on is that on the scaled monitor we're incorrectly drifting away because of rounding. I think bug 2003258 fixes this, can you confirm latest nightly doesn't show the issue?
| Reporter | ||
Comment 24•9 months ago
|
||
When I open Firefox, and move it to the second monitor, the nested empty folder get shown on my main monitor. This does not happen with nested folders that contain bookmarks.
If I maximize Firefox on the scaled monitor and open the empty nested folder, it will show up correctly when Firefox isn't maximized.
| Reporter | ||
Comment 25•9 months ago
|
||
Updated•9 months ago
|
Description
•