Closed Bug 1753414 Opened 3 years ago Closed 3 years ago

Contextmenu not working properly after switching tab

Categories

(Firefox :: Menus, defect, P3)

defect

Tracking

()

VERIFIED FIXED
99 Branch
Tracking Status
firefox99 --- verified

People

(Reporter: mbrodesser-Igalia, Assigned: Gijs)

References

(Regressed 2 open bugs)

Details

Attachments

(2 files)

STR:

1) Open some page.
2) Select some text.
3) Right click to open the context menu.
4) Switch tabs with Ctrl+PageDown.
5a) Click on "Inspect (Q)".
5b) Click "Copy".

After 5a) observe the errors:

JavaScript error: resource://devtools/client/fronts/inspector.js, line 286: TypeError: can't access property "getFront", target is null
JavaScript error: resource://devtools/server/connectors/js-window-actor/DevToolsFrameParent.jsm, line 217: TypeError: can't access property "notifyTargetDestroyed", watcher is undefined

After 5b) the clipboard content didn't change.

However, other functionality like "Open Link in New Tab" works after step 4).

It could be worth comparing what other browsers do here. On Ubuntu, I wasn't able to switch tabs using Ctrl+PageDown after the context menu was opened.

With Chrome, switching tabs via pressing the keys Alt+1 is blocked when a context menu is opened.

For end-users, I see little benefit of being able to switch tabs, while a context menu is opened. Also, the actual context is invisible when having switched tabs.

Ignoring keyboard commands to switch tabs while a context menu is open would be pretty straightforward, though we would need to add that code in quite a few places I assume.

We already ignore "Ctrl+N" to open a new window when a context menu is opened. I'm not sure if that is because they key has reserved=true (https://searchfox.org/mozilla-central/rev/072f9e6b7f10a00e12d0a02ac713431d0a7ee368/browser/base/content/browser-sets.inc#119) or if there is some other code that does this.

Neil, what do you think about making this change?

Flags: needinfo?(enndeakin)

Menus should already be cancelling shortcut keys while they are open, but this doesn't look like a regression, or at least the same issue occurs in a build I tried from 2019 at least.

My testing shows that the menu code in XULPopupManager appears to cancel the event properly, so something else is failing here.

Of note, shortcuts like Ctrl+T are properly ignored, but Ctrl+PageDn is not.

Since this appears to only fail on Linux, I wonder if this is related to native key binding support. Maybe masayuki knows where to start looking?

Flags: needinfo?(enndeakin) → needinfo?(masayuki)

(In reply to Neil Deakin from comment #3)

Of note, shortcuts like Ctrl+T are properly ignored, but Ctrl+PageDn is not.

Since this appears to only fail on Linux, I wonder if this is related to native key binding support. Maybe masayuki knows where to start looking?

This also fails on Windows.

  • Ctrl+PageDn switches tabs and leaves the context menu open
  • Ctrl+T switches tabs but closes the menu
  • Ctrl+N fails to open a new window while the page context menu is open

This also fails on Windows.

  • Ctrl+PageDn switches tabs and leaves the context menu open
  • Ctrl+T switches tabs but closes the menu

I can't reproduce the Ctrl+T behaviour. The menu stays open and no tab is opened. I do see the Ctrl+PageDn behaviour however.

(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #2)

Ignoring keyboard commands to switch tabs while a context menu is open would be pretty straightforward, though we would need to add that code in quite a few places I assume.

We already ignore "Ctrl+N" to open a new window when a context menu is opened. I'm not sure if that is because they key has reserved=true (https://searchfox.org/mozilla-central/rev/072f9e6b7f10a00e12d0a02ac713431d0a7ee368/browser/base/content/browser-sets.inc#119) or if there is some other code that does this.

Likely not, but perhaps https://searchfox.org/mozilla-central/rev/2a0b0ababd4541ecffb74cbe0820a9d0a25da636/browser/locales/en-US/browser/browserContext.ftl#334-336 prevents this.

Neil, what do you think about making this change?

(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #4)

(In reply to Neil Deakin from comment #3)

Of note, shortcuts like Ctrl+T are properly ignored, but Ctrl+PageDn is not.

Since this appears to only fail on Linux, I wonder if this is related to native key binding support. Maybe masayuki knows where to start looking?

This also fails on Windows.

  • Ctrl+PageDn switches tabs and leaves the context menu open
  • Ctrl+T switches tabs but closes the menu
  • Ctrl+N fails to open a new window while the page context menu is open

Like Neil (comment #5), I can't reproduce the Ctrl-T behaviour. Jared, can you doublecheck/screencast/clarify the circumstances in which you're seeing this?

I think Masayuki's diagnosis in comment #6 seems accurate as far as ctrl-pageup/down goes; we can use defaultPreventedByChrome to avoid web content being able to prevent tab navigation shortcuts from working. That should be a straightforward patch.

The comments in this bug are now a bit confusing. Leaving aside Jared seeing this for Ctrl-T on Windows, is the ctrl-pageup/dn case the only one where this breaks on linux, or do "regular" shortcuts like Ctrl-N / Ctrl-T also bypass the menu-based blocking of shortcuts that Neil mentions in comment #3?

Severity: -- → S3
Flags: needinfo?(jaws)
Priority: -- → P3
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/a2ccb6c1d2e9 stop switching tabs with the context menu open, r=NeilDeakin
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
QA Whiteboard: [qa-99b-p2]

I tried to reproduce the issue on Win10 using a build without fix 98.0a1(20220203190329), and I was able to switch tabs using CTRL+PgDn while context menu is opened.
On fixed version Beta 99.0 (20220328190900) on Win10 and Ubuntu 20.4 I am not able to switch tabs using CTRL+PgDn while context menu is opened. Is this the intended behavior? Thank you.

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Monica Chiorean from comment #15)

I tried to reproduce the issue on Win10 using a build without fix 98.0a1(20220203190329), and I was able to switch tabs using CTRL+PgDn while context menu is opened.
On fixed version Beta 99.0 (20220328190900) on Win10 and Ubuntu 20.4 I am not able to switch tabs using CTRL+PgDn while context menu is opened. Is this the intended behavior? Thank you.

Yes.

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(monica.chiorean)

Mark issue as verified based on above comment.

Status: RESOLVED → VERIFIED
Flags: needinfo?(monica.chiorean)
Regressions: 1778080
Regressions: 1899751
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: