You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a button is placed in the endContent of a SelectItem, clicking the button not only triggers the button's action but also selects the item and closes the select popover. This prevents the button from functioning independently within the select item.
I've tried the following workarounds without success:
Using e.stopPropagation() in the button's onClick handler
Using e.preventDefault() in the button's onClick handler
Using onPointerDown with e.stopPropagation() and e.currentTarget.focus()
None of these solutions prevented the select action from being triggered. I know this is kind of an anti-pattern, but it's also not unheard of. For the time being, I have a workaround using Popover and Listbox, as I'm able to stop the propagation of the click event from a ListboxItem's endContent.
HeroUI Version
2.7.0
Describe the bug
When a button is placed in the
endContent
of aSelectItem
, clicking the button not only triggers the button's action but also selects the item and closes the select popover. This prevents the button from functioning independently within the select item.I've tried the following workarounds without success:
e.stopPropagation()
in the button's onClick handlere.preventDefault()
in the button's onClick handleronPointerDown
withe.stopPropagation()
ande.currentTarget.focus()
None of these solutions prevented the select action from being triggered. I know this is kind of an anti-pattern, but it's also not unheard of. For the time being, I have a workaround using Popover and Listbox, as I'm able to stop the propagation of the click event from a
ListboxItem
'sendContent
.Your Example Website or App
https://stackblitz.com/~/github.com/spencerjsmall/vite-template
Steps to Reproduce the Bug or Issue
endContent
of one or more SelectItemsExpected behavior
Clicking the button should only trigger the button's action without selecting the item or closing the select popover.
Screenshots or Videos
No response
Operating System Version
macOS
Browser
Chrome
The text was updated successfully, but these errors were encountered: