design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

Global Header / Global Navigation: Menu Behavior

Open mbeard opened this issue 10 years ago • 9 comments

Recently, I believe there were changes to Global Navigation to ensure that multiple dropdown menus were not open at the same time. That appears to be resolved now, but I did encounter a similar issue, where a dropdown menu remains displayed when clicking from a nav dropdown to a nav link

  1. Click on a nav item dropdown to display the menu
  2. Click on a nav item link
  3. Notice the nav item dropdown menu is not hidden

Also, please verify the issue with multiple menus being displayed is resolved for Global Header menus too. I was able to display the help, settings, and profile menus all at the same time.

screenshot 2016-07-21 20 24 36

mbeard avatar Jul 22 '16 00:07 mbeard

@tweettypography

mbeard avatar Jul 22 '16 00:07 mbeard

Should be fixed in v0.2.0

tweettypography avatar Jul 22 '16 14:07 tweettypography

Looks like there are still some issues when combining keyboard nav and mouse nav, as well as when clicking onto links rather than onto the background or other menus

tweettypography avatar Jul 22 '16 21:07 tweettypography

@tweettypography where do you want to capture clicking away from the dropdown menu to close it? or is that working as expected?

i'd expect at a minimum that a dropdown on profile and nav should not be open at the same time.

for external clicks you may consider this solution https://github.exacttarget.com/stephenwilliams/marketing-cloud-app/blob/MCGLOBALNV-373_integrate_ported_account_switcher/Package/Dynamic/lightning-experience/public/src/utilities/external-click-mixin.js

swilliamset avatar Jul 26 '16 16:07 swilliamset

We use react-onclickoutside package in other components. If we go this route, we may use it.

Although TetherJS/Drop should be dealing with this, I know there's an outside click trigger within its API. I'll also check to see if this is a regression and worked in earlier versions of dropdown, too.

interactivellama avatar Jul 26 '16 16:07 interactivellama

Seems to be an issue with just the global nav. I just tried a link next to the dropdown and and another dropdown and they all seemed to worked as expected with mouse clicks.

2016-07-26 14 20 50

interactivellama avatar Jul 26 '16 18:07 interactivellama

Use of href="#" means that the event needs to be prevented. I'm thinking about not preventing the click event to allow dropdown menus to close (which seem to be listening on a ancestor DOM node).

Just leave out the href if you are going to use onClick. Although this would break URLs for bookmarking (Don't break the internet even if it's an SPA!). Hmm... will think about it some more.

Related to #484

interactivellama avatar Jul 26 '16 18:07 interactivellama

Our trap event is a little too heavy-handed for a link. I used trapEvent this without understanding all the stuff that trapEvent does.

https://github.com/salesforce-ux/design-system-react/blob/master/utilities/EventUtil.js#L16

interactivellama avatar Jul 26 '16 19:07 interactivellama

By the way, the old dropdown had a bunch of focus checking to handle outside clicks and it now uses just a window event. If we are using another library elsewhere it'd be worth opening a ticket to inestigate bringing that in here

tweettypography avatar Jul 26 '16 23:07 tweettypography