When I click on an item and remove the class active, the menu is still visible because :not([data-ui]):focus-within > menu CSS definition is taking over. Screenshot:
The alternative solution I found is to add a dummy data-ui, and it will only use the active class to show/hide the menu:
The first method to show the menu requires only the class
active
, however, I couldn't make it work:When I click on an item and remove the class
active
, the menu is still visible because:not([data-ui]):focus-within > menu
CSS definition is taking over. Screenshot:The alternative solution I found is to add a dummy
data-ui
, and it will only use theactive
class to show/hide the menu: