fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

ContextualMenu Closes on OSX Modifier Keys

Open alxHenry opened this issue 8 years ago • 16 comments

Bug Report

  • Package version(s): 5.23
  • Browser and OS versions: Chrome - OSX Sierra

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? Yes

Requested priority: Normal - May be an accessibility issue?

Products/sites affected: Yammer

Describe the issue:

When you have the ContextualMenu open on OSX, pressing command or option will close the menu. This can be annoying for a situation where a user wants to command click to open a link in a new window. It also may have accessibility ramifications, but I'm unsure on that.

Expected behavior:

Option or Command would not close the ContextualMenu.

If applicable, please provide a codepen repro:

Go to demo page on OSX, click a ContextualMenu example to open the dropdown, press Option or Command and observe the dropdown close.

alxHenry avatar Mar 05 '18 18:03 alxHenry

I believe this is because in Chrome, pressing Option pulls focus away from the DOM to the hamburger menu in the browser chrome. The same happens on Windows when pressing Alt.

I agree this is annoying. Trying to gauge the best fix.

We could:

  1. Leave open if focus is moved from the DOM to an unknown location.
  2. Close menu if focus has been moved to anywhere else within window or documentElement.

@joschect thoughts?

dzearing avatar Mar 05 '18 20:03 dzearing

@dzearing The contextualmenu/callout already shouldn't dismiss if the window gets focus. I have no other ideas as to what could cause this. The only keydown that the menu cares about is escape. If the document is what's being focused, then we could add that as an exception.

joschect avatar Mar 06 '18 02:03 joschect

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React!

stale[bot] avatar Apr 11 '18 03:04 stale[bot]

FWIW, it's not unique to Chrome; it happens in Safari as well (haven't tested others). Also, haven't experienced this to be true myself:

I believe this is because in Chrome, pressing Option pulls focus away from the DOM to the hamburger menu in the browser chrome.

Maybe it's a user setting, but option doesn't blur stuff in the document for me in Chrome or Safari. Also note that the issue isn't just for the option key, it's for command (⌘) as well.

andrewbranch avatar Apr 12 '18 21:04 andrewbranch

This issue has been automatically marked as stale because it has not activity for 60 days. It will be closed if no further activity occurs within 14 days of this comment. Thank you for your contributions to Fabric React! Why am I receiving this notification?

stale[bot] avatar Jul 01 '18 19:07 stale[bot]

The same problem happens when I use the "Zoom" accessibility feature from macOS. I configured my system to use Control + Option as modifier keys, and menus will close as soon as I try to zoom in.

vdepizzol avatar Jul 05 '18 23:07 vdepizzol

I got so fed up with this in VSTS that I did some digging myself, and discovered that this was done on purpose 😱: https://github.com/OfficeDev/office-ui-fabric-react/pull/3923

It's worth noting that in current master, the behavior has switched from the keyDown handler to the keyUp handler: https://github.com/OfficeDev/office-ui-fabric-react/blob/f052a832ec92854dc09a3adbcb76ba73a689454c/packages/office-ui-fabric-react/src/components/ContextualMenu/ContextualMenu.base.tsx#L720-L732

Can we revisit this decision? The stated justification of

This is consistent with Office application in the app.

and

Seems like this is consistent with windows file explorer and the menus in browsers as well.

ignore conventional differences between native Windows controls and web (not to mention the fact that macOS does not close menus on modifier keys; typically alt/option reveals more advanced menu options and command does nothing)—crucially, web users need to be able to open links in new tabs by holding ctrl/command, so this behavior is super frustrating when someone is hovering a menu item that behaves as a link, and they think “I’d like to open this page in a new tab,” hold ctrl/command, and the menu disappears.

andrewbranch avatar Jul 26 '18 20:07 andrewbranch

@jspurlin @christiango This is particularly gross and probably should be revisited.

Could we not do this? At least for macos command key. I 100% agree with the comments above; this feels overreaching.

dzearing avatar Nov 01 '18 22:11 dzearing

I've assigned to you @aneeshack4 but first lets get consensus before addressing anything here.

dzearing avatar Nov 01 '18 22:11 dzearing

Confirmed with @jspurlin that undoing this would be ok.

dzearing avatar Nov 06 '18 01:11 dzearing

Just a note @dzearing, I'm fine with scoping this so that only option/alt can be used to expand/collapse menus. If we removed it completely, how would a user be able to expand a comboBox or splitButton?

jspurlin avatar Nov 06 '18 18:11 jspurlin

Aneesha if you've already started on this, feel free to steel back, otherwise seems like a simple issue for @ecraig12345 to take a shot at.

dzearing avatar Nov 08 '18 16:11 dzearing

I haven't gotten a chance to start on this so @ecraig12345, if you want go for it!

aneeshack4 avatar Nov 08 '18 23:11 aneeshack4

Could someone please clarify exactly what the requested fix is here? Is it to add a Mac-specific case where pressing Alt/Opt or Command (without down arrow or other keys) should not close the menu? Or to revert some/all of @jspurlin's change from #5207 (and if so, which parts)?

Also, if we're adding a Mac-specific case, how should the user agent check be handled? Currently the only place I see a user agent check for Mac is in KeytipLayer, but since we're adding a second check I wonder if it's worth moving to a utility.

ecraig12345 avatar Nov 09 '18 18:11 ecraig12345

:tada:This issue was addressed in #7061, which has now been successfully released as @uifabric/[email protected].:tada:

Handy Links:

msft-github-bot avatar Nov 14 '18 13:11 msft-github-bot

:tada:This issue was addressed in #7061, which has now been successfully released as [email protected].:tada:

Handy Links:

msft-github-bot avatar Nov 14 '18 13:11 msft-github-bot