UserMenu Avatar onClick overrides the open behavior #307
Labels
brightlayer-ui
Used to identify Brightlayer UI platform issues for easy filtering
bug
Something not working as expected
good first issue
A good issue for first-time contributors
high-priority
Issues that should be fixed sooner than later
user-menu
Affects User-Menu Component
Describe the bug
If you put a
onClick
event on the Avatar that is passed into a UserMenu, that prop overrides the onClick behavior that is set up to open the menu.What is the expected behavior?
The user-supplied
onClick
should be merged with the internal click handlerWhat are the steps to reproduce?
onClick
prop to the Avatar, e.g.,<Avatar onClick={() => console.log('clicked')}>AB</Avatar>
Anything else to add?
This is caused because we spread the user supplied Avatar props after defining the onClick prop (https://github.com/pxblue/react-component-library/blob/dev/components/src/core/UserMenu/UserMenu.tsx#L140). This causes the user-supplied onClick prop to overwrite what we set on the line above. The spread should come before the onClick.
The text was updated successfully, but these errors were encountered: