News for hackers. Stuff that matters.
Re:In Praise of the Unambiguous Click Menu by clord on Saturday March 20, 2021 @10:11AM (#26523360)
I didn’t test this but won’t the focus-within trick work for click menus too? The user clicks the button (which must be a child of the container) so focus moves within the container and hence the submenu can show.

nav:focus-within > .submenu {display:block}

(Edit: oh it’s mentioned in the article briefly without much explication of the need for js)

Re:In Praise of the Unambiguous Click Menu by layer8 on Saturday March 20, 2021 @10:22AM (#26523425)
It’s okay for submenus to expand on hover, because the user is already mentally in a menu context if they clicked to open the top-level menu. That is common desktop behavior too. However, it’s preferable for the submenu to stay open until some other menu navigation takes place (e.g. a sibling submenu opens), because it’s much too easy to accidentally leave the submenu area with the pointer.