Closed Bug 1661516 Opened 4 years ago Closed 3 years ago

[Wayland] context menu automatically selects last entry on right click

Categories

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

80 Branch
Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: salmon.remi, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0

Steps to reproduce:

When right clicking in the bottom right corner of the screen, the last entry of the context menu is automatically selected when releasing the right click.

Happens only under wayland; when using xwayland the context menu shows as expected.

Reproduced with firefox 80.0 and firefox nightly 82.0a1 on Fedora 32.

Actual results:

The screenshot tool show up on right click (see attached video).

Expected results:

The context menu should show up.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
OS: Unspecified → Linux
Hardware: Unspecified → Desktop
Summary: Wayland context menu on bottom right of screen automatically selects last entry → [Wayland] context menu automatically selects last entry on right click

Looks like the xdg_positioner is setup to open the menu in a way that the menu is only offset correctly to the right and downwards. That means when it is flipped in both x and y directions (because you open it close to the bottom right corner) the last menu element will automatically be selected.

The way to setup the xdg_positioner is to create a 1x1 "anchor rect" corresponding to the click position, and setup the anchors and gravity so that it opens downwards to the right, with the flip y and flip x hints set so that the anchor and gravity are flipped, i.e. the menu is opened upwards/leftwards outside of the same 1x1 rect.

Priority: -- → P3

Jan, any idea here?

Flags: needinfo?(jhorak)

A workaround/fix could be to disable right click actions on the context menu itself maybe?

Right now right clicking on an entry of the context menu activates that entry (not useful/necessary and triggers this bug).
Looking at the main "hamburger" menu, right clicking on an entry does nothing (as expected).

To flip context menu correctly near the monitor edge we need to use
correct gravity and anchor of 2x2 size for the gdk_window_move_to_rect.

Assignee: nobody → jhorak

The fix does not deal with the font scaling != 1. (ie. 1.25, or 1.5) when rounding errors happens and the popup is repositioned due to this. Followup bug 1708709.

Flags: needinfo?(jhorak)
Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/eecb6331a2c1
Use right gravity for the context menu to flip it correctly; r=stransky
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch

I think bug 1701877 is a dupe.

Please backout this bug. It causes popup regressions and we need to think about it.

Flags: needinfo?(sheriffs)

Backed out for causing popup regressions.

Backout link

Status: RESOLVED → REOPENED
Ever confirmed: true
Flags: needinfo?(sheriffs)
Resolution: FIXED → ---
Target Milestone: 90 Branch → ---
Priority: P3 → P1

The bug is not just is which direction the menu draw but also that right clic randomly opens a "dynamic menu".

The menu closes if you release right clic.
If you keep right clic clicked and move the mouse on the menu entry you want, releasing right clic select that entry.
Sometimes, a static menu is open as expected, releasing right clic keep the menu open and you can select what you want.

Let's fix that when Bug 1710436 lands.

Assignee: jhorak → stransky

Can you please test latest nightly under Wayland? A new popup handling code landed there.
Thanks.

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

Can you please test latest nightly under Wayland? A new popup handling code landed there.
Thanks.

This issue is still present under Wayland in nightly 91.0a1 (2021-06-04) (64-bit).

Attachment #9226090 - Attachment description: Bug 1661516 [Wayland] Compensate context menu shift from nsMenuPopupFrame::SetPopupPosition() when popup window is shifted back, r?jhorak → Bug 1661516 [Wayland] Don't use context menu shift in nsMenuPopupFrame::SetPopupPosition(), r?jhorak
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/27149a6f3ca9
[Wayland] Don't use context menu shift in nsMenuPopupFrame::SetPopupPosition(), r=jhorak
Attachment #9219547 - Attachment is obsolete: true
Attachment #9219547 - Attachment is obsolete: true
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/7b82d177a6b9
[Wayland] Don't use context menu shift in nsMenuPopupFrame::SetPopupPosition(), r=jhorak
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Regressions: 1716491
Flags: qe-verify+
Regressions: 1726939
Regressions: 1726323
Regressions: 1750487
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: