

Let’s use it to make our website menus awesome! Switching to click menus Regardless of your device or input mode, a “click” is a more universal and solid interaction. Using anything other than a mouse? Pressing ENTER or activating a link with any type of switch control is more equivalent to clicking than :focus is equivalent to :hover.File, Edit, etc.)? Those almost never appear on hover! Using a touch device? Hover isn’t really a thing there.When you think about it, click menus are actually what we expect already in most other contexts: We’ll deal with what happens to those top-level pages in a moment. All links are contained in submenus except for top-level items that have no submenu (e.g.Site visitors must click the parent item to view its submenu.This instantly solves the hover menu problem because click menus work unambiguously. Instead of relying on the hover interaction or some other “creative” (and confusing) solution, let’s build menus where parent items are buttons that show and hide submenus when clicked. So, what’s the better option? Enter the click-triggered submenu! Click menus to the rescue Until someone hovers or focuses the arrow button, they probably won’t guess it’s independent of the link.

Because it’s so uncommon, I find that visitors often overlook the top-level page link, and research suggests that users don’t perceive a label and icon as being separately clickable. The Twenty Fifteen default WordPress theme uses that pattern. Probably the least common type of menu I see uses a “split button” design where the parent item is a link and a separate drop-down icon opens and closes the menu. It makes it impossible to satisfy Jakob’s law of usability that “users prefer your site to work the same way as all the other sites they already know.” There is no standard implementation when it comes to hover menus, so we need to do something different to provide a consistent user experience.

Try using both your mouse and the TAB key to move through the demo. These days, we can improve the accessibility of CSS-only menus with a newer trick! Menus can open and close when navigating them with a keyboard, thanks to :focus-within. * Position submenus relative to parent list item */ (It was probably after reading this 2003 article from A List Apart.) At the time, it was a true CSS trick.
#Hide out clique how to#
I still remember my excitement when I learned how to build a hover-triggered submenu with just CSS.
