[v2] Click events not firing on elements of custom Menu
See original GitHub issueFirst of all, thanks for this great component. I’ve run into the following issue: I need to add a button as part of the select Menu, but the click events are not firing.
Sandbox example: https://codesandbox.io/s/jz0r9nln69
Code:
const Menu = props => {
return (
<React.Fragment>
<button onClick={() => alert("clicked")}>
Click me and nothing will happen
</button>
<components.Menu {...props}>{props.children}</components.Menu>
</React.Fragment>
);
};
export default class SingleSelect extends Component<*, State> {
render() {
return (
<Select
className="basic-single"
classNamePrefix="select"
name="color"
options={colourOptions}
components={{ Menu }}
/>
);
}
}
Stopping the propagation of the event doesn’t seem to help.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
JQuery click event not working on links with # - need to show ...
I need to show / hide the submenus on click on mobile. So nothing happens when Item 1 is clicked but item 2...
Read more >Click event not firing after perform click menu item
I Unable to perform click the "Exit" menus on the image above. It only highlights the button upon testing the perform click, but...
Read more >Firing Events - Testing Library
Convenience methods for firing DOM events. Check out src/event-map.js for a full list as well as default eventProperties .
Read more >Context Menu click event not firing for custom ... - Syncfusion
Hi there, I'm having a small issue with a custom context menu on a grid. Try as I might, I cannot seem to...
Read more >How to trigger a click() event on LWC element
Same thing I tried to do on the LWC element but it is not working. Template code [HTML] <template> <div class="standerdRelatedListCustom"> <div ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @giuband , I am trying to have focus on an input in the menu. Not happening. How did you customize for your issue? Maybe that’ll give me some hint
<components.Menu {...props}> <input placeholder="Input test" />{props.children} </components.Menu>
How to stop firing of close menu when select is blurred. I want to somehow modify the logic of onBlur event. I also tried implementing a custom menu and it closes because onBlur is triggered.