Item context menu appears instead of section menu or column header menu
Hi! Weird bug I've been having for a few days now. Zotero is up-to-date (7.0.9), Mac is up-to-date (15.2), did a fresh installation of Zotero and tried this on a new profile:
Whenever I right-click on an item, library, collection, the appropriate context menu appears, in the appropriate place. However, when I right-click on the item tree's column headers (i.e., to add a column), or on a section icon (to pin it, for instance), the last context menu appears (in its original location) instead of the column/section menu. For instance:
- Right-click on item
- Item menu shows below item
- Right click on section icon
- Item menu shows below item (again)
- Right-click on library
- Library menu shows below library
- Right-click on column header
- Library menu shows below library (again)
This means that I've been unable to change my column headers or pin sections... Any idea as to the cause?
Whenever I right-click on an item, library, collection, the appropriate context menu appears, in the appropriate place. However, when I right-click on the item tree's column headers (i.e., to add a column), or on a section icon (to pin it, for instance), the last context menu appears (in its original location) instead of the column/section menu. For instance:
- Right-click on item
- Item menu shows below item
- Right click on section icon
- Item menu shows below item (again)
- Right-click on library
- Library menu shows below library
- Right-click on column header
- Library menu shows below library (again)
This means that I've been unable to change my column headers or pin sections... Any idea as to the cause?
Sort options are now part of the View main menu. Makes sense, but it's a bit unexpected to right-click the columns (as I think was how it was done in the past) and see an unrelated popup appear). However, I haven't found the reason why the section pin/unpin context menu doesn't appear.
And the corresponding reports: D917971095, 2077675019
It shouldn't really matter, but is this a MacBook or a Magic Trackpad?
Note that it's probably not the "last" context menu that's appearing — it's just triggering the context menu on the selected tree row. If you just left-click a collection or item and then two-finger tap on something else, you'll likely see the same behavior.
I think the issue stems from this line: https://github.com/zotero/zotero/commit/23f9ebcd17b773b7389171ea9c2b1332288d9b01#diff-0ec361a3df0e76da5d502b97d1a3e1a08f19332ae39197b7deb23cce0512d77fR51
The code captures all contextmenu events, except those that match (NOT secondaryButton OR NOT buttons=0 OR ctrlKey pressed). In other words, it only considers secondary clicks that are triggered with Ctrl. For reference, here are the MouseEvent properties I was able to log in Safari:
- Two-finger click: contextmenu which=3 button=2 buttons=0 ctrlKey=false
- Ctrl+click: contextmenu which=1 button=0 buttons=1 (but also sometimes 0??) ctrlKey=true
- Ctrl+Enter shortcut: contextmenu which=3 button=2 buttons=0 ctrlKey=false (!)
As you can see, a Ctrl+Enter context menu triggers the exact same "signature" as the two finger click. The only difference is that clientX/Y are both set to 1 in my testing when using Ctrl+Enter...
TL/DR; assuming the whole event retarget is necessary (haven't tested it before 7.0.8), the logic test that excludes events from this retarget should not only filter out ctrl+click events but also regular secondary clicks (which is what the two finger click does here).
I only see it if I two-finger tap, not two-finger click.
Two-finger tap is supposed to bring up options/context menus for *selected* items (as far as I understand), so while this is a bit unexpected and annoying, I am not sure if it is entirely the wrong behavior.
But yes, the behavior is wrong — you can see in, say, Finder that a two-finger tap behaves the same as a two-finger click and shows the context menu at the cursor position, not for the selected file.
In any case, we've already fixed this for the next beta (because I accidentally wrote down "tap" when creating a ticket and another developer reproduced it).