-
Notifications
You must be signed in to change notification settings - Fork 0
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 semantics for PhET navigation bar #25
Comments
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: |
I had a few questions about the HTML in the template:
|
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
I used
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 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:
The second and third items are the relevant in our PDOM. |
In the example, Scenery places the list outside the footer when it is visible. When invisible, the list does not exist in the DOM. <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
Understood, thanks @terracoda. If it becomes a problem, we can certainly investigate further.
Understood, thanks! Scenery can do it, but it is a matter of implementation. |
@jessegreenberg, regarding your comment:
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 <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> |
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 |
@jessegreenberg, a Browser/AT implementation of 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?
Menubar Role?
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 (#25 (comment)). Another consideration on
@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
|
@jessegreenberg, there's a mistake in the same code above. The role menuitem has to go on the actual item, not the parent Since we have buttons and links inside the <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 (w3c/aria-practices#13 (comment)). I have a feeling that the sim's bottom bar is too essential, more akin to primary site navigation, to be using the role 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? <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 |
@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 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? |
Actually, VO is doing the same now, presumably because we added |
@jessegreenberg, I also noticed |
@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 |
@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" phetsims/resistance-in-a-wire#136 (comment). |
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:
The text was updated successfully, but these errors were encountered: