Doist/reactist

MenuItem should call the provided `onClick` if present

gnapse opened this issue ยท 3 comments

๐Ÿ› Bug report

Current behavior

Given a MenuItem with a onClick handler, the onClick is not called when the menu item is clicked.

Steps to reproduce the bug

It was part of the cause of the bug fixed in Doist/twist-web#3049.

Possible solutions

To check if props.onClick is present inside the handleClick (ref) and call it.

Maybe it was not a good thing to have used this new name, and I could've stuck with onClick instead. This may cause the confusion.

Maybe it was not a good thing to have used this new name, and I could've stuck with onClick instead. This may cause the confusion.

Does it make sense to only have support for onClick and get rid of onSelect for consistency's sake with the built-in <Button> component?

Maybe. Though not urgent. Since it is a breaking change, maybe we leave it for when we enhance the menu components to support being used as context menus. Something that I have plans to do at some point, hopefully in the near future.

This was fixed in #477