Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close context menu on item click in Chip component (#263)
Fixes DHIS2-6611. **Problem** Context menu doesn't close after mouse click on "Manage axes" menu item. Clicking on other menu items ("Move to category", "Move to filter" and "Remove") "closes" menu, but under the hood it just removes chip & menu entirely, therefore the problem was unnoticeable before introducing "Manage axes" menu item. **Solution** Close menu programmatically after mouse click on menu item. **Implementation** Since we generate menu items in `DefaultAxis` component and pass them as props to `Chip` which renders `Menu` - we don't have control over `Menu` in `DefaultAxis` component. To solve this without changing current architecture we can use React built-in `cloneElement` function and assign one more `onClick` callback function to menu items which closes the menu.
- Loading branch information