Live data from Hacker News

Accessible hamburger buttons without JavaScript

pausly.app

51–60 of 154 posts

Re: Accessible hamburger buttons without JavaScript

#51
post #2

Learn how to create an accessible hamburger button with pure HTML and CSS and why that is important.

Not really super important, but thoughts on using an SVG when the same hamburger button affect can be generated with just a tiny bit of HTML/CSS? As little as one element with :before/:after for the top/bottom bars, although sometimes it needs a wrapping element for best styling.

Re: Accessible hamburger buttons without JavaScript

#52
post #27

Earlier quoted context omitted.

> Screen reader users do not need to open or close menus. Agreed, but you don’t want keyboard accessible menu items available for users that aren’t visually impaired. Offering a “show menu” button to screen readers is not less accessible to them than skipping the navigation section. If you’re building a page that is only meant to be used by screen readers, then you are absolutely right. > Meanwhile, non screen reader…

Offering a show menu button to screenreader users is accessible but poorly usable . They can’t see the menu. ‘Showing’ and ‘hiding’ mean nothing to them. And for your keyboard navigators using the visual interface, perhaps this hints that you could afford them a similar opportunity - where, from being focused on the menu, they could either descend into the menu, expanding it, or skip the menu and move focus to the ne…

Mh.. yes I agree. "Expand menu" and “Collapse menu" is probably a better wording.

Re: Accessible hamburger buttons without JavaScript

#53
post #41

On my site we have a "menu" link styled as a button. Before JS loads it'll link to a page we have that lists out all the menu options (literally navigating to oursite.com/menu). After JS kicks in the link gets hidden and an identical button gets shown that does the fancy side menu opening thing. TFA's approach seems nice enough but mine feels way simpler...

This would be way too frustrating to me :)

Re: Accessible hamburger buttons without JavaScript

#54

Earlier quoted context omitted.

I remember a business manager having zero idea that clicking the logo at the top of a webpage would often take you to the home page. I had assumed this was ubiquitously understood, but clearly not.

It seems people don't explore at all. There's no "I wonder what would happen if" impulse, or there's an "I'd better not just in case" worry.

And the lack of tooltips on hover. WTF, it's missing on loads of big properties.

Re: Accessible hamburger buttons without JavaScript

#56
post #40

Except modern HTML actually has a builtin which is accessible, and works far better with screenreaders and other assistant technologies. The details element. Menu Home Thing You may want to add a tiny bit of CSS, like adding a border, and setting the cursor to a pointer, for your sighted users: details { padding: 0.5em; border-style: solid; border-width: 1px; border-radius: 0.25em; cursor: pointer; }

You should still wrap the list in a element to give the browser the context about what the menu represents.

Re: Accessible hamburger buttons without JavaScript

#57
post #14

Earlier quoted context omitted.

The only intuitive user interface is a nipple. Everything else has to be learned.

I presume you're being down-voted for the use of the word "nipple," by people who don't know that this is an axiom that has been used in the design industry for a very long time.

It's a fun little meme, but it's not all that accurate. Something like half of mothers report latching or other nipple-baby interface problems in some studies [0]. What's more, suckling is a hardwired reflex, not something that's intuited, so the quote also misunderstands the nature of intuition.

FWIW I also used to use that quote, until I had a child and saw firsthand [well, second-hand as it was my wife doing the work] how much effort breastfeeding a newborn could take; I don't really blame anyone for quoting it (it's pithy after all).

Surprisingly good further discussion on the UX SE [1].

0: https://www.npr.org/sections/health-shots/2013/09/23/2253491...

1: https://ux.stackexchange.com/questions/5150/is-it-true-that-...

Re: Accessible hamburger buttons without JavaScript

#58
post #27

Proof that accessibility and usability are entirely orthogonal. For screen reader users only , this provides them with the information that activating this link will open or close a menu. Screen reader users do not need to open or close menus. Menus do not take up space or sit in front of other content. Closing a menu offers no usability benefit to a screen reader user. All they need is the options to be present unde…

> Screen reader users do not need to open or close menus. Agreed, but you don’t want keyboard accessible menu items available for users that aren’t visually impaired. Offering a “show menu” button to screen readers is not less accessible to them than skipping the navigation section. If you’re building a page that is only meant to be used by screen readers, then you are absolutely right. > Meanwhile, non screen reader…

The 'main' menu? Implying, there are other menus.

So is the ≡ the main navigation menu?

The account options menu?

The preferences menu?

The menu of the application platform that's wrapping the page you're on, rather than the page itself?

The menu showing all the sister companies of the site you're on?

Re: Accessible hamburger buttons without JavaScript

#59
post #40

Except modern HTML actually has a builtin which is accessible, and works far better with screenreaders and other assistant technologies. The details element. Menu Home Thing You may want to add a tiny bit of CSS, like adding a border, and setting the cursor to a pointer, for your sighted users: details { padding: 0.5em; border-style: solid; border-width: 1px; border-radius: 0.25em; cursor: pointer; }

Unfortunately there are still plenty of issues with the details element, especially around accessibility. Read more here: https://cloudfour.com/thinks/a-details-element-as-a-burger-m...

Hopefully this will change soon. I’ll amend the article when this will be the case.

Re: Accessible hamburger buttons without JavaScript

#60

> "Over the last few decades hamburger buttons have become the de facto standard to expand larger menus on smaller devices. They are so ubiquitous that every user immediately knows what they are when seen in the top left or right corner, which makes them a good user interface element choice." "Last Few Decades"? Eh? A decade.. perhaps? "Every User Immediately"? This is not at all my experience. Perhaps with younger u…

I agree. Hamburger buttons were popularized with smartphones so they are still relatively new. Here's a good breakdown on why they suck https://www.nngroup.com/articles/hamburger-menus/

tl;dr "Discoverability is cut almost in half by hiding a website’s main navigation. Also, task time is longer and perceived task difficulty increases."

Post reply on HN