We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have used Wrapper alongside other components inside MyComponent where it has its own click event handler.
MyComponent
<MyComponent onClick={this.handleClick}> {otherComponents} <Wrapper> <Button> click me </Button> <Menu className='MyMenuButton-menu'> <ul>{menuItems}</ul> </Menu> </Wrapper> </MyComponent>
It would seem that a click on Button propagates event to MyComponent & triggers its click event handler.
Button
The text was updated successfully, but these errors were encountered:
You can handle this in your MyComponent ?
Sorry, something went wrong.
At first I got around this by using this onClick handler on Button
handleClick = (e: React.MouseEvent) => { const { disabled } = this.props; e.stopPropagation(); if (disabled) { return; } if (document.querySelector(`#${this.wrapperId} > [role="menu"]`)) { closeMenu(this.wrapperId); } else { openMenu(this.wrapperId); } };
But then I used this one instead on Wrapper since I had other buttons inside Menu itself.
Wrapper
Menu
handleClick = (e: React.MouseEvent) => { e.stopPropagation(); };
Is it possible to share a working example ?
No branches or pull requests
I have used Wrapper alongside other components inside
MyComponent
where it has its own click event handler.It would seem that a click on
Button
propagates event toMyComponent
& triggers its click event handler.The text was updated successfully, but these errors were encountered: