Skip to content
New issue

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

child menu Item or parent onclick event? #2

Open
tomcon opened this issue Oct 20, 2021 · 1 comment
Open

child menu Item or parent onclick event? #2

tomcon opened this issue Oct 20, 2021 · 1 comment

Comments

@tomcon
Copy link

tomcon commented Oct 20, 2021

Hi,

Thanks for this.
I seem to be missing something simple as I can't see any event to hook into when a child menu item or parent is actually clicked.

@jutunen
Copy link
Member

jutunen commented Oct 20, 2021

Hi,

custom element handles (steals) the heading onclick event when the mode is click.
This issue could be circumvented by listening to onmousedown events instead of onclick events.
When the mode is hover, heading onclick event is emitted normally.
Item onclick events seem to be emitted normally, I tested with this code:

<wc-menu-wrapper mode='click'>
    <div class='heading' onclick="console.log('heading clicked')" onmousedown="console.log('heading mousedown')"> Menu </div>
    <div class='item' onclick="console.log('item clicked')"> 1st item </div>
    <div class='item'> 2nd item </div>
    <div class='item'> 3rd item </div>
 </wc-menu-wrapper> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants