-
Notifications
You must be signed in to change notification settings - Fork 163
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
A11y: replace span subIndicator with button #204
Comments
This is something that I'm starting to look into as well, and wasn't sure if there was an existing option for this sort of markup, or how SmartMenus could be extended. The article I'm attempting to emulate is the one on Fly-out Menus from the W3C, which includes this as an example menu item under "Approach 2: Use button as toggle" <li class="has-submenu">
<a href="#flyoutnavkbbtn" aria-expanded="false">Space Bears</a>
<button aria-expanded="false"><span><span class="visuallyhidden">show submenu for “Space Bears”</span></span></button>
<ul>
<li><a href="#flyoutnavkbbtn">Space Bear 6</a></li>
<li><a href="#flyoutnavkbbtn">Space Bear 6 Plus</a></li>
</ul>
</li> I do see this sort of markup in the new Configurator tool that you announced a short while ago - is the intent to start supporting this type of markup with version 2? |
Yep, this is supported in version 2. Each item could have a separate link and a sub toggler button. Here is a sample: <li class="sm-nav-item">
<a class="sm-nav-link sm-nav-link--split" href="#">Link</a><button class="sm-nav-link sm-nav-link--split sm-sub-toggler" aria-label="Toggle sub menu"></button>
<ul class="sm-sub">
...
</ul>
</li> The script will automatically set any required accessibility related attributes (e.g. As an example, the version 2 docs` sidebar menu is build with such split links. Please note the code is still in alpha and I already have some plans to possibly introduce quite notable changes (e.g. reorganizing the CSS to make it more modular, etc.) but if it works for you as it is, actually I believe it is quite stable. |
In recent accessibility testing, we found that a screen reader user could not effectively operate the mobile navigation. The recommended solution was to replace the
<span>
subIndicator, with<button>
, adjacent to the link.OLD:
NEW:
This would allow the user to use the link to navigate to the page, and the button to reveal the submenu, with no confusion as to which action would trigger which result.
I was thinking we could add two new options for
subIndicatorsPos
that would allow the item to be placed adjacent to the link instead of within. Something likeprependAdjacent
andappendAdjacent
.And perhaps we could add another setting for
subIndicatorsTag
that could be eitherspan
orbutton
.The text was updated successfully, but these errors were encountered: