Skip to content

Component Menu, trigger event handler on MenuItem when MenuItem is activated #2477

Answered by segunadebayo
dohaicuong asked this question in Q&A
Discussion options

You must be logged in to vote

I suppose you can use the onSelectcallback to trigger and event on the item yourself.

function onSelect(details){
  const item = document.querySelector(`[data-value=${details.value}]`)
  item.click() // or item.dispatchEvent(new CustomEvent('itemselect', { details }))
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dohaicuong
Comment options

Answer selected by dohaicuong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants