beercss icon indicating copy to clipboard operation
beercss copied to clipboard

Menu Component: active class does not work (first method)

Open steevepay opened this issue 1 year ago β€’ 2 comments

The first method to show the menu requires only the class active, however, I couldn't make it work:

<button>
  <span>Button</span>
  <menu class="no-wrap active">
    <a>Item</a>
    <a>Item</a>
    <a>Item</a>
  </menu>
</button>

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:

Screenshot 2024-04-07 at 18 35 31

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:

<button data-ui="btn">
  <span>Button</span>
  <menu class="no-wrap active">
    <a>Item</a>
    <a>Item</a>
    <a>Item</a>
  </menu>
</button>

steevepay avatar Apr 07 '24 14:04 steevepay

Is a fix for this coming?
Removing the .active class from the menu is still not closing the menu.

greenersharp avatar Nov 16 '24 15:11 greenersharp

Also, the list is allways showing at the bottom of the menu. So you can't use the button at the bottom of the screen

Baraw avatar Nov 20 '24 16:11 Baraw