-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* expose `close` function for `Menu` and `Menu.Item` components The `Menu` will already automatically close if you invoke the `Menu.Item` (which is typically an `a` or a `button`). However you have control over this, so if you add an explicit `onClick={e => e.preventDefault()}` then we respect that and don't execute the default behavior, ergo closing the menu. The problem occurs when you are using another component like the Inertia `Link` component, that does have this `e.preventDefault()` built-in to guarantee SPA-like page transitions without refreshing the browser. Because of this, the menu will never close (unless you go to a totally different page where the menu is not present of course). This is where the explicit `close` function comes in, now you can use that function to "force" close a menu, if your 3rd party tool already bypassed the default behaviour. This API is also how we do it in the `Popover` component for scenario's where you can't rely on the default behaviour. * update changelog
- Loading branch information
1 parent
af68a34
commit 83a5f45
Showing
6 changed files
with
144 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you think we could also expose
open
(under some different name as it's taken already)? It will make it possible to have a controlledMenu
which doesn't rely on having left-click trigger.Having it, we can create a workaround for issues like #649