New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 859779 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 1
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug-Regression
M-X



Sign in to add a comment

MacViews - Accessing menu bar while toolkit-views menu is running does not dismiss the menu

Reported by jeffreyc...@gmail.com, Jul 3

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.42 Safari/537.36

Steps to reproduce the problem:
1. Bring up context menu by right-clicking on current page.
2. Access any item/tab in the menu bar (e.g., File, Edit, etc.)

What is the expected behavior?
The context menu should be dismissed and the menu bar click should not be registered/activated.

What went wrong?
The context menu stays visible and the menu bar click registers. This is how it is when MacViews is off.

Did this work before? N/A 

Chrome version: 68.0.3440.42  Channel: beta
OS Version: OS X 10.13.5
Flash Version:
 
macviews.mov
3.0 MB View Download
Here is how it works with MacViews off
cocoa.mov
1.9 MB View Download
Cc: robliao@chromium.org ellyjo...@chromium.org
Components: -UI Internals>Views>Desktop
Labels: Proj-MacViews
Thanks for filing this report.
(I think AppKit sends out a private notification for opening a mainMenu item, or manipulating a toolbar icon there - maybe to NSDistributedNotificationCenter rather than NSNotificaitonCenter - adding an observer with a nil object and NSLog ing it should let us see the name)
Labels: Needs-Triage-M68
Cc: susan.boorgula@chromium.org
Labels: -Type-Bug -Pri-2 ReleaseBlock-Stable Triaged-ET M-69 RegressedIn-68 hasbisect FoundIn-68 FoundIn-69 Target-69 Target-68 Pri-1 Type-Bug-Regression
Owner: spqc...@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce this issue on Mac OS 10.13.3 on the latest Canary 69.0.3482.0 and Beta 68.0.3440.42 by enabling the flag #views-browser-windows.
Issue is not applicable to Windows 10 and Ubuntu 14.04.

Bisect Information:
===================
Good Build: 68.0.3431.0
Bad Build : 68.0.3432.0

By running the per-revision bisect script, float division by zero error was coming up. Hence below is the manual changelog URL from omahaproxy.

https://chromium.googlesource.com/chromium/src/+log/68.0.3431.0..68.0.3432.0?pretty=fuller&n=10000

From the above Changelog, suspecting the below change:
Reviewed-on: https://chromium-review.googlesource.com/1056468

spqchan@ Please check and confirm if this issue is related to your change, else help us in assigning to the right owner.
Adding 'ReleaseBlock-Stable' label as this is a recent regression. Please feel free to remove if this is not applicable.

Thanks
Labels: -M-69 Group-Focus_Input_Selection_Activation_KeyState
Labels: M-69
Labels: -Pri-1 -ReleaseBlock-Stable Pri-2
Status: WontFix (was: Assigned)
We switched to Cocoa menus
Cc: spqc...@chromium.org
Labels: -Pri-2 -M-69 Hotlist-Polish M-X Pri-3
Owner: ----
Status: Available (was: WontFix)
Summary: MacViews - Accessing menu bar while toolkit-views menu is running does not dismiss the menu (was: MacViews - Accessing menu bar while context menu is visible does not dismiss context menu)
There's still a bug here..  but lower-priority.

E.g. the `Folder` combobox dropdown on the Add Bookmark dialog should be dismissed when accessing the mainMenu bar.
Labels: -Target-69 -Target-68
Re comment 3, those notifications are not private.

The one I'd recommend is NSMenuDidBeginTrackingNotification (https://developer.apple.com/documentation/appkit/nsmenudidbegintrackingnotification) which is posted on [NSNotificationCenter defaultCenter]. That would be an easy one to watch for.
That actually wouldn't match Mac menus.

Mac menus capture any mouse click anywhere and eat it on dismissal. We'd need to install an event monitor to really do this right.
We do install an event monitor :)

Menus use Widget::SetCapture which instantiates a views::CocoaMouseCapture -- https://cs.chromium.org/chromium/src/ui/views/cocoa/cocoa_mouse_capture.h?q=CocoaMouseCapture&sq=package:chromium&g=0&l=24

It installs both a local and a global monitor for mouse events. Note clicks on other applications can not be eaten, but they do dismiss the menu. This is consistent with native menus.

I don't know why the monitors don't see the event that opens the mainMenu though :/

NSMenuDidBeginTrackingNotification might work. I think there's a special event that's specific to the mainMenu bar though, in case NSMenuDidBeginTrackingNotification isn't delivered (due to the mainMenu being out of process?). Or maybe that's just for clicking the wifi/battery/volume widgets that are up there (which also don't eat the event for native menus, just "observe" it).
I just found CocoaMouseCapture. Will investigate.

NSMenuDidBeginTrackingNotification totally works for the main menu. It doesn't work for the widgets, but we can mix in NSWindowDidResignKeyNotification and NSApplicationDidResignActiveNotification if needed.
Widgets are out of process, so a click on them triggers the global handler. No idea yet what is going on with clicks in the menu bar.
Menu bar clicks are

2018-07-30 20:25:44.237 Chromium[45253:11044646] local block event NSEvent: type=SysDefined loc=(1050,527) time=1654500.4 flags=0x100 win=0x0 winNum=0 ctxt=0x0 subtype=7 data1=1 data2=1


But this is really bizarre. I'm seeing SysDefined/7 events when I click the menu button, which makes little sense. And swallowing the SysDefined/7 events isn't preventing the menu showing.

I'm going to go with the simpler route of notifications.
Owner: a...@chromium.org
Status: Fixed (was: Available)
Labels: TE-Verified-M70 TE-Verified-70.0.3510.0
Able to reproduce the issue on Mac 10.12.6 on reported chrome version 68.0.3440.42.

Verified the fix on Mac 10.12.6, as per comment#0 on latest chrome version #70.0.3510.0.
Attaching screen cast for reference.
Observed that the context menu got dismissed when the menu bar is clicked.
Hence, the fix is working as expected.
Adding the verified labels.

Thanks...!!
859779.mp4
563 KB View Download

Sign in to add a comment