Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The solution for handling top-level menu items which are also hyperlinks? #991

Open
ianthedev opened this issue Feb 24, 2019 · 17 comments
Open
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy Example Page Related to a page containing an example implementation of a pattern question Issue asking a question

Comments

@ianthedev
Copy link

ianthedev commented Feb 24, 2019

As explained by @terrill in #145 (shortcut), it's a widely used approach to make navigation menu's top-level menu items not only trigger sub-menus on mouseover, but also serve as hyperlinks that link to top-level landing pages on click.

The said approach is very common and isn't showing any sign of going out of fashion, from what I can see.

The current example of navigation menubar, however, isn't addressing the hyperlink thing for AT and sighted keyboard users.

Could we please have an instruction on how to properly make AT and sighted keyboard users able to use top-level menu items' hyperlinks?

@patrickhlauke
Copy link
Member

The solution is fairly simple: either stop doing that (don't actually make the top-level item a link, or provide a separate control to open/close the menu. See https://www.w3.org/WAI/tutorials/menus/flyout/

Additionally, I'd note that the ARIA menu pattern isn't really meant for navigation, but app-like menus (though this point seems to be disputed(. In that context, no native application menu behaves in a way where clicking on the menu's button (e.g. "File", "Edit", "View", etc.) triggers any kind of functionality.

@ianthedev
Copy link
Author

ianthedev commented Feb 24, 2019

@patrickhlauke I agree with you that the ARIA menu pattern is meant for app-like menus, not for navigation.

So it looks like the two navigation examples (the aforementioned one and the menu one) might be disputable.

@LaurenceRLewis
Copy link

If interested this is a good article by Bryan Garaventa of WhatSock and Level Access on native html and aria menus https://www.levelaccess.com/challenges-mega-menus-standard-menus-make-accessible/

@LaurenceRLewis
Copy link

LaurenceRLewis commented Feb 24, 2019

I would not recommend the Fly-out Menu example given as it uses aria-haspopup which I don't recommend in this situation (Authors MUST ensure that the role of the element that serves as the container for the popup content is menu, listbox, tree, grid, or dialog). It it also broken because the aria-expanded is stuck on true. I built a menu based on the article menus article I posted and discussions I have had regarding accessible menus. Please note the website is my personal testing website, however, if you want to use the menu as is or change it to improve it, be my guest. Oh and it uses jQuery, sorry, but my JavaScript skills are urg :-)
https://www.a11ycats.com.au/m05_c01_p01.html

@ianthedev
Copy link
Author

ianthedev commented Feb 25, 2019

@Decrepidos Thanks. That makes sense.

Now I decide to avoid using role=menubar, role="menu", and aria-haspopup because those are apparently meant for application, not for navigation.

But in your example, I see the use of role="heading" as sub-menus' headings. I'm not sure if that's okay. If I understand correctly, headings are meant for identifying sectioning element such as section, article, nav, and aside.

Besides, it's fine to use jQuery, in my opinion, as vanilla code is often longer and more complicated.

@LaurenceRLewis
Copy link

LaurenceRLewis commented Feb 25, 2019

@Ian-Y role heading and aria-level indicate the structural level of the menu. This helps screen reader users identify the nested menu levels—especially if there are multiple levels. Probably not needed when there is only one nested menu level. However, I tend to use role heading and aria- level after discussions with @accdc who recommended it. :-)

@ianthedev
Copy link
Author

ianthedev commented Feb 25, 2019

@Decrepidos I see. So some screen reader users prefer that.

I'm under an impression that screen reader users often navigate through headings to find interesting content more quickly. They can also bring up a dialogue box which is built-in in screen readers and contains all headings in a page.

Wouldn't it be tiresome for them to repetitively hear those same headings of navigation sub-menus from page to page?

@LaurenceRLewis
Copy link

LaurenceRLewis commented Feb 25, 2019

Not from what I have been told. The person who recommended it is a totally blind screen reader user. 😬 Using JAWS for examples the Q key moves the screen reader to start reading from the main landmark. Then the H key can be used to skip through the content headings. So a screen reader user would not need to jump through the role headings in the menu for each page.

@ianthedev
Copy link
Author

@Ian-Y I understand. Thank you for the information. :)

@mcking65 mcking65 added enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy question Issue asking a question Example Page Related to a page containing an example implementation of a pattern labels Feb 25, 2019
@mcking65 mcking65 added this to the 1.1 APG Release 4 milestone Feb 25, 2019
@LaurenceRLewis
Copy link

@Ian-Y Hi, if you're interested I updated the navigation to include optional the submenu expanding on mouseover. I also fixed a couple other minor bugs. https://www.a11ycats.com.au/m05_c01_p01.html

@ianthedev
Copy link
Author

ianthedev commented Feb 27, 2019

@Decrepidos Thank you. Because we haven't heard any word about this issue from W3C, I decide to just adopt the traditional "tab navigating" method for now. For sub-menus, I'm making them appear when the top-level lis receive any focus inside.

Although this method requires AT/keyboard users to navigate through all links inside nav one by one, it is the least confusing method I can think of now.

@LaurenceRLewis
Copy link

No problem. Good luck. 😬

@LaurenceRLewis
Copy link

@Ian-Y FYI Recent discussions with a blind screen reader user who is also an accessibility developer found ‘If role heading and aria-level is implemented, expanding the subsection it is a clear indicator that the section starts at a particular point, so the heading is helpful for that plus can quickly jump between them using the H and Shift+H keys with or without the sections being expanded, and even use the rotor on iOS to swipe between headings using single swipe up/down gestures.

@ianthedev
Copy link
Author

@Decrepidos Thanks for the info. That is worth considering. Hopefully, the specification can advise on the viability of using sections and headings for navigational sub-lists so that developers are more confident in implementing it.

@stes-acc
Copy link

I think a new ARIA menu role property aria-menutype="navigationmenu" / aria-menutype="navigationmenuitem" as indicator that this menu is a hierachical list of links could ease the pain.

To do it role-wise we could have alternatively role="navigationmenu" and role="navigationmenuitem".

We could even do this already today using respective aria-roledescription strings for menu and menuitem role.

Still authors have to implement arrow key navigation and menu open triggering as for app menus.

With this we could indeed have menus consisting of links and looking like classic application menus. We do see this frequently in Joomla menu components, for example.

Thoughts?

@patrickhlauke
Copy link
Member

i'd caution that it's not as easy as just inventing a new role="..." attribute. these need to match up (at least conceptually) with roles that browsers can expose via accessibility APIs, and that can then be understood by AT consuming them...

@stes-acc
Copy link

Well there is also #159 gracefully stating "hey, there is no problem using menu and menuitem roles also for pure navigation menus". If so, then ARIA Specifications should mention this usage explicitly. And if so, parts of this issue render absolutely obsolete.

The real challenge then is that menu-like structures using hyperlinks are then FORBIDDEN because there is no role counterpart. But they are out there....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy Example Page Related to a page containing an example implementation of a pattern question Issue asking a question
Development

No branches or pull requests

5 participants