Closed jessegreenberg closed 6 years ago
Here is the HTML for the navigation bar as it is now (In this case, only one screen):
<div role="navigation" id="60-67">
<button id="60-67-69-120">Hot Keys and Help</button>
<button aria-haspopup="true" id="60-67-69-112">PhET</button>
</div>
And when the PhET Menu is open:
<div role="navigation" id="60-67">
<button id="60-67-69-120">Hot Keys and Help</button>
<button aria-haspopup="true" id="60-67-69-112">PhET</button>
</div>
<ul role="menu" id="60-159-71">
<li id="parent-container-60-159-71-97-78" role="menuitem">
<button role="link" id="60-159-71-97-78">PhET Website…</button>
</li>
<li id="parent-container-60-159-71-97-81" role="menuitem">
<button role="link" id="60-159-71-97-81">Report a Problem…</button>
</li>
<li id="parent-container-60-159-71-97-84" role="menuitem">
<button id="60-159-71-97-84">Check for Updates…</button>
</li>
<li id="parent-container-60-159-71-97-87" role="menuitem">
<button id="60-159-71-97-87">Screenshot</button>
</li>
<li id="parent-container-60-159-71-97-90" role="menuitem">
<button id="60-159-71-97-90">Full Screen</button>
</li>
<li id="parent-container-60-159-71-97-94" role="menuitem">
<button id="60-159-71-97-94">About…</button>
</li>
</ul>
Here is a version of it running: http://www.colorado.edu/physics/phet/dev/html/john-travoltage/1.3.0-dev.18/john-travoltage-a11y-view.html
I had a few questions about the HTML in the template:
<a>'s
. Can they be buttons?<a>'s
are used in the PhET menu, could we use <button>'s
with role="link"?For instance, the recommendation for the PhET Menu is
<!-- Design pattern adapted from Pickering's menu button.-->
<nav aria-label="Sim tools and links">
<button aria-expanded="false">PhET Menu</button>
<!-- <p>Tools and links for this sim.</p> -->
<ul hidden aria-hidden="true">
<li><button>View Options</button></li>
<li><button>Check for Updates</button></li>
<li><button>Take Screenshot</button></li>
<li><button>Full Screen</button></li>
<li><a href="https://phet.colorado.edu/files/troubleshooting/?BIG-LONG-LINK">Report Problem</a></li>
<li><button>About this Sim</button></li>
<li><a href="http://phet.colorado.edu/">PhET Website</a></li>
</ul>
</nav><!-- end PheT Menu Nav -->
Could it be something like
<footer>
<...other stuff...>
<nav aria-label="Sim tools and links">
<button aria-dexpanded="false">PhET Menu</button>
</nav>
</footer>
<!-- When open this is visible, otherwise it isn't in the DOM -->
<ul hidden aria-hidden="true">
<li><button>View Options</button></li>
<li><button>Check for Updates</button></li>
<li><button>Take Screenshot</button></li>
<li><button>Full Screen</button></li>
<li><button role="link">Report Problem></button</li>
<li><button>About this Sim</button></li>
<li><button role="link">PhET Website</button></li>
</ul>
@jessegreenberg, having the list of items immediately after the button is a progressive enhancement technique. Basically, it means if the css or js fail, the items are still right there inside the labeled nav and immediately after the button that provides the iconic identification.
In your examples, does Scenery place the list outside the footer once it is visible? Structurally to me this makes no sense.
Is the problem the placement of the list, or the operation of the buttons in the list if the buttons are embedded too deeply?
I think, if the menu has to be "disconnected" from the button, in the PDOM hierarchy, then it would it be useful to establish the relationship using aria. The problem is that aria-controls is very unreliable.
@jessegreenberg, excellent questions
- Screens are represented as
<a>
's. Can they be buttons?
I used <a>
's for the list of screens in the template because my understanding of the sim screens is that they are part of the same page. Buttons generally indicate some kind of function, not a link to other content. However, buttons can be used to show and hide content. Buttons are a possibility. Tab panel navigation is usually a list of links, however with some special aria attributes.
- Having the menu inside the footer would be non-trivial to implement due to the way modal dialogs are added to the view. Is the structure in #25 (comment) acceptable?
One of the goals at this point is to implement with as little change to Scenery as possible, so maybe we should revisit how hierarchical relationships are managed soon, but not now. I think of the PDOM as a well-structured, semantically rich HTML document. Often the simplest way to show relationships is through the natural hierarchy. There are other ways to communicate relationship, but they may be less robust. Let's see how users interpret the bar and the menu with less natural nesting.
<a>
s are used in the PhET menu, could we use<button>
's withrole="link"
?
A button with the role link is not a good idea. Links and buttons have different key presses and communicate different things to the users. The presence of a link tells the user that they will be taken somewhere, either to another section, page, or site. A button tells the user they are going to do something (but not go anywhere necessarily), submit a form, open a dialog, show hidden content. These 2 items in the PhET Menu go to urls, so they are semantically links to other pages.
@jessegreenberg, can Scenery not put a link in this context?
@jessegreenberg, Pickerings says to avoid:
- Background images for icon rendering.
- Omitting accessible names and labels.
- Small touch (or hit) areas.
- Foregoing accessible state communication. Excerpt From: Heydon Pickering. “Inclusive Design Patterns." iBooks.
The second and third items are the relevant in our PDOM.
In your examples, does Scenery place the list outside the footer once it is visible? Is the problem the placement of the list, or the operation of the buttons in the list if they buttons are embedded too deeply?
In the example, Scenery places the list outside the footer when it is visible. When invisible, the list does not exist in the DOM. The problem is the placement of the list. The simulation hierarchy looks like
<simulation>
<screens>
<navigation-bar>
<screen-buttons>
<keyboard-help-button>
<PhET-Menu-Button>
<dialog-layer>
<options-dialog>
<about-dialog>
<updates-dialog>
<PhET-Menu-list>
<simulation>
Which is why Scenery places the PhET menu list outside of the navigation bar in the parallel DOM as well. To change this, we would need to change the simulation hierarchy or the way scenery structures the PDOM. It would take some effort to do either of these, so it seemed worth investigating an aria solution if possible.
Thanks @terracoda!
Thanks, that makes sense. The problem is that the user ins't really "going" anywhere when they click on a button on the bottom, and there is no meaningful href
(not even to another place in the same page). In that case, <a>
tags aren't clickable.
One of the goals at this point is to implement with as little change to Scenery as possible, so maybe we should revisit how hierarchical relationships are managed soon, but not now. I think of the PDOM as a well-structured, semantically rich HTML document. Often the simplest way to show relationships is through the natural hierarchy. There are other ways to communicate relationship, but they may be less robust. Let's see how users interpret the bar and the menu with less natural nesting.
Understood, thanks @terracoda. If it becomes a problem, we can certainly investigate further.
A button with the role link is not a good idea. Links and buttons have different key presses and communicate different things to the users. The presence of a link tells the user that they will be taken somewhere, either to another section, page, or site. @jessegreenberg, can Scenery not put a link in this context?
Understood, thanks! Scenery can do it, but it is a matter of implementation. <button role="link">
would be trivial to implement, while <a href="...">
would take more time. Since there is a difference, I will look into using <a>
tags.
@jessegreenberg, regarding your comment:
The problem is that the user isn't really "going" anywhere when they click on a button on the bottom, and there is no meaningful href (not even to another place in the same page). In that case, tags aren't clickable.
If the user is taken to a new sim screen, how can that be "not really going anywhere"? I assume that each screen has an id. Can Scenery use the screen id for the href
? An anchor does indeed need an href
to be a clickable link, but the value of the href
does not have to be a url. It can be like this:
<nav aria-label="Sim Screens">
<ul>
<li><a href="#screen-01"><span class="visually-hidden">Current screen:</span> Screen 1</a></li>
<li><a href="#screen-02">Screen 2</a></li>
<li><a href="#sreen-home">home</a></li>
</ul>
</nav>
If the user is taken to a new sim screen, how can that be "not really going anywhere"
All the screen buttons at the bottom really do is toggle graphical visibility of the active screen. Screens don't have an id to point to with an href. The user is choosing to view new content, so I see how a link makes semantic sense. Would href="#"
work?
@jessegreenberg, a button
can make hidden content visible. For example, the accordion design pattern does this. There are accordion designs that only allow one accordion to be open at a time. It is then our responsibility to communicate the states of the accordions to the user. It's possible the accordion design pattern could work or the screens. I was even considering this, yesterday.
Browser/AT implementation of aria-controls
, however, currently does not work as it should. See Pickerings article, _ARIA_Controls is Poop._
We will have to make sure we can communicate the states of the accordions and their relationships to the sim screens clearly.
@jessegreenberg, I am having trouble with a design pattern for the bottom bar. I think we need to answer the question, What is the bottom bar?
Working on some pros and cons based on comments from the W3C ARIA 1.1 Specification
Navigation?
Footer?
A common convention for indicating that a menu item launches a dialog box is to append "…" (ellipsis) to the menu item label, e.g., "Save as …".
Menubar Role? Similar to role menu
It is looking like a menubar, this far to me.
Thanks for listing these out @terracoda, that really helps guide things! I agree that Menubar makes a lot of sense. I also like Footer based on its Pros and Cons.
Also, I read about the region role, but forgot to put that solution idea in the pros and cons post above (https://github.com/phetsims/a11y-research/issues/25#issuecomment-291131395).
Another consideration on menu
/menubar
role
The menu role is appropriate when a list of menu items is presented in a manner similar to a menu on a desktop application.
@jessegreenberg, please correct me if I am wrong, but I think the bottom bar does exhibit desktop-like behaviour.
How do these stripped down examples for a single screen sim look:
Footer with un-ordered list containing buttons
<footer aria-label="Sim Resources and Tools">
<!-- Could also use menubar and menu item roles in the list inside the footer, if that is valid. Need to check. -->
<ul>
<li>
<button aria-haspopup="true">Keyboard Shortcuts</button>
<p role="tooltip">Tips on how to use this sim with a keyboard.</p>
</li>
<li>
<button id="phet-menu-button" aria-haspopup="true">PhET Menu</button>
<p role="tooltip">Tools and links for this sim.</p>
</li>
</ul>
</footer>
<!-- PhET Menu items dynamically placed into PDOM. -->
<ul role="menu" aria-labelledby="phet-menu-button" hidden>
<!-- When menu is open, focus is placed on first item. -->
<li role="menuitem"><button>View Options</button></li>
<!-- Rest of the Phet Menu Items -->
</ul>
Div with region role, label, and menubar
<div role="region" aria-label="Sim Resources and Tools">
<ul role="menubar">
<li role="menuitem">
<button aria-haspopup="true">Keyboard Shortcuts</button>
<p role="tooltip">Tips on how to use this sim with a keyboard.</p>
</li>
<li role="menuitem">
<button id="phet-menu-button" aria-haspopup="true">PhET Menu</button>
<p role="tooltip">Tools and links for this sim.</p>
</li>
</ul>
</footer>
<!-- PhET Menu items dynamically placed into PDOM. -->
<!-- Same as above -->
General Notes
aria-controls
to create a relationship between the PhET Menu button and the actual PhET Menu does not currently provide much help for AT users (see https://github.com/phetsims/a11y-research/issues/25#issuecomment-290579725). Proximity of the menu may be more useful, but not currently possible in Scenery. Perhaps aria-owns
can be used? I need to read the spec more for aria-owns
.@jessegreenberg, there's a mistake in the same code above. The role menuitem has to go on the actual item, not the parent li
according to the Navigation Menu Button example which actually has anchor tags inside the list items.
Since we have buttons and links inside the li
, the code should be like this:
Div with region role, label, and menubar
<div role="region" aria-label="Sim Resources and Tools">
<ul role="menubar">
<li>
<button role="menuitem" aria-haspopup="true">Keyboard Shortcuts</button>
<p role="tooltip">Tips on how to use this sim with a keyboard.</p>
</li>
<li>
<button id="phet-menu-button" role="menuitem" aria-haspopup="true">PhET Menu</button>
<p role="tooltip">Tools and links for this sim.</p>
</li>
</ul>
</div>
<!-- PhET Menu items dynamically placed into PDOM. -->
<ul role="menu" aria-labelledby="phet-menu-button" hidden>
<!-- When menu is open, focus is placed on first item. -->
<li><button role="menuitem">View Options</button></li>
<!-- Rest of the Phet Menu Items -->
</ul>
@jessegreenberg, I did some further digging and found this comment from the ARIA Practices repo (https://github.com/w3c/aria-practices/issues/13#issue-151786266).
I have a feeling that the sim's bottom bar is too essential, more akin to primary site navigation, to be using the role menubar
, maybe we should go back to role navigation
, and simple lists with clear labels. The PhET Menu still seems to be a good fit for a menu button. I'll look again Heydon Pickering's example again.
What a design-code circle? I can't believe how complicated this has been :-) Maybe that's why Pickering wrote a whole chapter on the Menu Button design pattern!
@jessegreenberg, how does the following code and keyboard pattern look to you? Will it fit currently with Scenery? Do you think it will help users find the bar easily and use the PhET Menu button easily. Stripped-down Code
<div>
<ul role="navigation" aria-label="Sim Resources and Tools">
<li>
<button aria-haspopup="true">Keyboard Shortcuts</button>
<p>Tips on how to use this sim with a keyboard.</p>
</li>
<li>
<button id="phet-menu-button" aria-haspopup="true">PhET Menu</button>
<p>Tools and links for this sim.</p>
</li>
</ul>
</div>
<!-- PhET Menu items dynamically placed into PDOM. -->
<ul role="menu" aria-labelledby="phet-menu-button" hidden>
<li><button role="menuitem">View Options</button></li>
<!-- Rest of the Phet Menu Items -->
</ul>
Keyboard Design Pattern
In the popped-up menu
The Left and Right Arrow keys I need to double check how these should work.
@jessegreenberg, also I don't think navigation landmarks receive visual keyboard focus. The landmark information is just read out when the first at last items inside the landmark get focus.
Yes, that looks great to me @terracoda! Also, i just figured out that the aria role=none
needs to be on the li
items in the menu, or else focus doesn't work correctly in JAWS.
Discovered in the link you posted: https://www.w3.org/TR/wai-aria-practices-1.1/examples/menu-button/menu-button-2/menu-button-2.html, thank you!
But another problem, is that JAWS won't read any of the semantic information about the buttons/links in the menu - just its label content. Do have any ideas for how to get around this?
But another problem, is that JAWS won't read any of the semantic information about the buttons/links in the menu - just its label content.
Actually, VO is doing the same now, presumably because we added none
to the list item parent?
@jessegreenberg, I also noticed role=none
, sorry I thought I shared that info :-) I'll have to investigate why the semantics are lost.
@jessegreenberg, I do hear that it is a menu in VO, just don't hear about buttons and links.
Posting an article by Adrian Roselli on ARIA menus that I need to review in more detail http://adrianroselli.com/2017/10/dont-use-aria-menu-roles-for-site-nav.html
@jessegreenberg, based on our decision in the keyboard nav meeting (March 6th) to re-organize the bottom bar into two things for multi-screen sims:
See also RIAW for first example of "Sim Resources" https://github.com/phetsims/resistance-in-a-wire/issues/136#issuecomment-370871198.
From #13, @terracoda added some information about the semantics for PhET's navigation bar. Here is the content, copied from that issue:
I updated a sample html template for the sim’s bottom bar. I used a footer element instead of a tool or menu bar. This might be more reliable and provide a nice landmark.
I've used some nav elements with aria-labels, so it sounds pretty good in Voice Over, but it’s still quite rough. The PhET Menu buttons are not being read out yet (when expanded), and are not navigable with arrow keys (when expanded), so I think I have done something wrong there. I've adapted some tips from Pickering's Inclusive Design Patterns.
Also, I am not 100% sure if sim screen navigation should go inside or outside this footer. This decision does not have to happen immediately, but soon.
The sample template is in my own repo at this link: https://github.com/terracoda/phet-templates/blob/master/a11y-menu-template.html
@jesse, also, is this the active issue for this topic, or is issue #12, the proper place?
Note: Pickering has an nice pattern for using SVG on the button icon. I haven't included that as we likely do not need it in the hidden PDOM. It might be useful for other situations, though.
Note: I moved my HTML mock-ups to the A11y-Research repo. New links are: