Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Possible use of nav, or even menu element on the wrapper.
http://api.drupal.org/api/drupal/modules--toolbar--toolbar.tpl.php/7
Comment | File | Size | Author |
---|---|---|---|
#48 | 1190210-toolbar-48.patch | 5.35 KB | aspilicious |
#45 | 11902100-toolbar-45.diff | 13.5 KB | aspilicious |
#43 | ie7-rtl.png | 4.87 KB | aspilicious |
#43 | navStructure.png | 7.76 KB | aspilicious |
#43 | 11902100-toolbar-43.patch | 13.98 KB | aspilicious |
Comments
Comment #1
LewisNymanThe big question here is do we keep the list element or not.
We have an opportunity here to keep semantics but tidy up the mark up as:
The menu tag is a very good shout Jeff. It would be nice to distinguish the toolbar from the standard page nav.
Comment #2
Jeff Burnz CreditAttribution: Jeff Burnz commentedWell... menu is a permitted parent for li! So this is legal:
http://www.w3.org/TR/html-markup/li.html
Comment #3
LewisNymanOk, that seems like a pretty strong way to go.
<menu type="toolbar">
is the correct semantic meaning and it requires list items.I'm happy to give this patch a go. I need to start getting more friendly with the toolbar anyway.
Comment #4
Everett Zufelt CreditAttribution: Everett Zufelt commentedI did a quick test of the accessibility support for menu.
Testing with FF5, and JAWS 12 / NVDA 2011.1 no semantics were available. Recognizing that D8 release is quite some time away, and that UAs will more thoroughly implement the spec in this time, I still have some reservations with us making changes to Core that reduce the semantics available to screen-reader users.
Nonetheless, I do agree that menu type = toolbar is the correct semantic to be applied to this widget. My question is what do we do to ensure the best experience for all users. I'm not asserting a position here as much as begging the question, perhaps there should be a new discussion for this?
Comment #5
Everett Zufelt CreditAttribution: Everett Zufelt commentedComment #6
Everett Zufelt CreditAttribution: Everett Zufelt commentedThe situation for this specific widget improves if we add the WAI-ARIA toolbar role.
The implied ARIA role for menu is toolbar, but since UAs might not map this we can set the role explicitly. This would also improve accessibility of menu if used by UAs that support ARIA semantics, but not html5 semantics. We are still removing semantics for users of UAs that do not support html5 / ARIA semantics, and this is what we need to consider.
Comment #7
Jeff Burnz CreditAttribution: Jeff Burnz commentedEverett, I think everything comes in layers. Things like the actual recognized semantics of an element, or roles, are additional layers of accessibility improvement. My question is this - does using the menu element prevent you from using the Toolbar?
Comment #8
Everett Zufelt CreditAttribution: Everett Zufelt commented@Jeff
I agree that accessibility comes in layers, this is part of the reason that WCAG 2.0 specifies levels for each success criteria.
When assessing the accessibility of a page, or of part of a page, the four questions (WCAG 2.0 guidelines) are: is the content perceivable, is the content understandable, is the content operable, is the content robust?
In this specific case we have a toolbar, which at its essence is a list of links with a special purpose. I am not incredibly concerned that when using menu type = toolbar -> li some users will not perceive the toolbariness of the content, but I am concerned that they will lose the semantics of his being a related list of links.
As an aside, @SteveFaulkner wrote on Twitter:
Comment #9
Jeff Burnz CreditAttribution: Jeff Burnz commentedThe acid test here is "is this operable" because it does not fail any of the other success criterion. First, the hidden heading clearly identifies these links as a "toolbar". Secondly, the links are still real anchor elements with all states preserved. I would think this is very much operable, and would not fail this criterion, in any case testing patches is what we do.
Lets not veer off into FUD about HTML5, clearly that statement is not true and is certainly not something for this issue.
Comment #10
Everett Zufelt CreditAttribution: Everett Zufelt commented@Jeff
To be clear, at this time, I am not able to be supportive of using <menu> in Core. It reduces the semantics available to screen-reader users. As far as I know it is not implemented in any UA, which means we have no way of predicting how it will be implemented.
Should there be some sign that UAs are implementing menu type = toolbar in a way that provides equivalent, or greater, semantics to screen-readers I would remove my objection. I would also be happy to remove my objection with further persuasive comments.
Comment #11
Jeff Burnz CreditAttribution: Jeff Burnz commentedEverett - I think its a tricky argument we're getting into here and I think you're going to need to expand on what you describe as "reducing the semantics available to screen-reader users", because this is not clear to me and afaict not actually true - what does seem an issue is how some user agents are making use of the semantics. For example if Jaws or NVDA do not recognize the menu element then something is seriously wrong with those agents because menu element was introduced into HMTL spec so far back I can't find when (before HTML3), and in HTML4 became deprecated but should be supported by all user agents for backwards compatibility. Therefor there are no more or no less semantics available here, they are the same.
Comment #12
Everett Zufelt CreditAttribution: Everett Zufelt commented@Jeff
Using elements that are not supported by UAs is not going to work. It doesn't matter if you, or I, would like for them to be supported: they are not.
Currently, with ul - li, JAWS and NVDA lets the user know that there is a list. With menu - li they do not. If this is do to lack of support in JAWS / NVDA, or w/ Firefox, or both, I do not know.
The processing model of a page is thus:
1. UA (firefox) parses the page into the DOM.
2. UA (firefox) parses the DOM into the accessibility API (IA2)
3. UA (JAWS) uses the DOM and accessibility API in order to present information (content and semantics) to the user.
Comment #13
LewisNymanOk, it looks like we have three paths to go down.
There's always a realistic cut off point for support. We can't guess at what that will be in a few years time.
Comment #14
Jeff Burnz CreditAttribution: Jeff Burnz commentedYep, I know we can't crystal ball gaze too much.
I popped open an issues that might make things a little easier if we went with
<menu>
: #1203908: Add a type parameter to theme_linksLewis, how about dumping some basic markup examples of what you are thinking so we can run them through the various screen-readers etc before we start knocking up patches.
I tested this out and got pretty good results in FF5/IE9 + NVDA (I dont have a working JAWS atm).
In IE9 this is correctly described as a menubar and a toolbar and the list items are read out correctly. For example when leaving the menubar NVDA says "out of toolbar, out of menubar...". FF5 was pretty good also.
Comment #15
cosmicdreams CreditAttribution: cosmicdreams commentedSo we're not going to use the ...
.. tag?
Comment #16
LewisNymanLet's test this out,
I'm curious to see if there are issues with this catch all solution. Nested lists and combined
<menu>
and<nav>
. Semantically you could argue for all these elements and it would degrade nicely enough/Comment #17
Jeff Burnz CreditAttribution: Jeff Burnz commented@15, nothing decided as yet, we're just having friendly discussions, but if menu element presents insurmountable issues then we can't use it, pretty simple as that, see Everetts posts - my testing confirms Everett's concerns, so menu would need explicit setting of role (and each child element as well possibly).
Comment #18
Jeff Burnz CreditAttribution: Jeff Burnz commentedOK, what I found is that with NVDA and FF5 and IE8/9 #16 is announced exactly the same as #14.
NVDA says: "Menu toolbar menu item one link, menu item two link, menu item three link".
If I remove the roles NVDA + IE8/9 correctly announce the menu element as a list, but not Firefox. With the roles in place it all appears to work just fine, i.e. as Everett alluded to earlier role="toolbar" makes all the difference (not a problem in my book).
We need to repeat the test with Jaws - I think we only have to worry about FF5 and above and IE8+ (thinking ahead a couple of years no one will be using anything less than FF5).
The upshot of this is, that if we go with something like #14 we need theme_links patched to take menu element as a type, and we also need some feedback from Jacine on this, its not really what I would think to be a standard use of menu and a command toolbar, but I think it could make sense here.
Comment #19
jessebeach CreditAttribution: jessebeach commentedHere's a first pass at a patch. I also posted a patch for #14.
I ended up needed to clean up a lot of overly-specific CSS selectors like div#toolbar. Just more reason not to type selectors if it isn't semantically necessary. I imagine we're going to run into this a lot as we change the markup to use HTML5 elements.
Comment #20
jessebeach CreditAttribution: jessebeach commentedUpdating this patch to use the list type array key #list after an update to http://drupal.org/node/1203908#comment-4690726. The contextual links use the array key #type for their own purpose, so co-opting the key name for the theme_links function caused the contextual links to render improperly.
Comment #21
mgiffordTagging.
Comment #22
JacineThe patch here no longer applies. It fails on:
Can we please post the CSS changes in #1217048: Clean up the CSS for Toolbar module though? There's already a patch there. In the future, if we want to do the templates and CSS together (which is fine), just mark the CSS issue as a dupe and update the template issue title to reflect the CSS work too. We just need to make sure we are not duplicating efforts unnecessarily.
Also, I am completely fine with the proposed
theme_links()
changes, and I agree that<menu>
could make sense here, but I am a little leery of using it until there's at least one browser implementation. When the browser implementation hits, and it may break ours. I think I'd rather go with<nav>
until then, and revisit</menu>
to be safe, but I'll support whatever you guys to decide.Comment #23
Everett Zufelt CreditAttribution: Everett Zufelt commented+1 to holding off on <menu> until there is at least one browser implementation.
Comment #24
aspilicious CreditAttribution: aspilicious commentedPart of the shortcut cleanup is needed because of the template changes.
I left out the toolbar css changes.
I also left out the menu stuff for now as it isn't supported yet by any browser.
Comment #25
Everett Zufelt CreditAttribution: Everett Zufelt commentedCan we please add role="navigation" to the <nav>? I'm not sure about the nav wrapping the entire toolbar, as the menu itself is primary, and a lot of the rest seems superfluous, but I could go either way on that.
Comment #26
aspilicious CreditAttribution: aspilicious commentedLike this?
Comment #27
Everett Zufelt CreditAttribution: Everett Zufelt commentedYes.
I also notice that the role="toolbar" is added to each list of items. I'm not sure that is going to be best practice. Toolbar http://www.w3.org/TR/wai-aria/roles#toolbar is meant to be used for things that are toolbars, as in a desktop application. I'd recommend removing the toolbar roles, and just leaving the navigation role. Note: this is the opposite of what I suggested in #6, apologies.
Comment #28
aspilicious CreditAttribution: aspilicious commentedwhat about type=>toolbar?
Comment #29
Everett Zufelt CreditAttribution: Everett Zufelt commentedDidn't notice that. @type is a state for the <menu> element, which we aren't using here. Again, I believe that the intent of <menu> is to be an interactive element, much like a menu in a desktop application, think of the Google Docs menu (File, View, etc.)
Comment #30
aspilicious CreditAttribution: aspilicious commentedComment #31
aspilicious CreditAttribution: aspilicious commentedMore info:
http://stackoverflow.com/questions/4969801/nav-or-menu-html5
So nav it is :)
Comment #32
aspilicious CreditAttribution: aspilicious commentedWorking on a new and BETTER approach :p with richthegeek
Comment #33
richthegeek CreditAttribution: richthegeek commentedThis is what myself and aspilicious came up with - using the nav element is a more semantic approach, and reduces the tag soup in this one small area.
Requires review for:
- ARIA / accessibility (we removed the header stuff from theme_links for theme_nav)
- RTL (no rtl changes made yet at all)
- correctness and all other shiny things.
Comment #34
aspilicious CreditAttribution: aspilicious commentedAttached the discussion that drove us to this approach
Comment #36
richthegeek CreditAttribution: richthegeek commented(ignore this epic failure on my part)
Comment #37
richthegeek CreditAttribution: richthegeek commentedOk, fixed prior bug and added attempt at RTL css.
Comment #38
richthegeek CreditAttribution: richthegeek commentedComment #39
richthegeek CreditAttribution: richthegeek commentedFixed RTL issues entirely (it looks identical to me vanilla d8 vs d7).
Comment #40
Everett Zufelt CreditAttribution: Everett Zufelt commentedI won't comment on the approach. But, please make sure that $attributes['role'] = 'navigation' is set somewhere by default.
Comment #41
aspilicious CreditAttribution: aspilicious commentedAdded the role=>navigation by default
Comment #43
aspilicious CreditAttribution: aspilicious commentedOk new patch without windows endings ;)
Screenshots to show IE7 in rtl (and it works :D )and one to show what this means (semanticly).
Comment #45
aspilicious CreditAttribution: aspilicious commentedOk my editor settings are officially broken...
Comment #46
JacineI don't love the theme_nav() idea. Seems like needless duplication, and also a job for theme_links(), which should ideally have a configurable wrapper element. I believe there is already an issue for that. I also think that some of this needs to be output in a list, not just links.
We definitely need more feedback here on the approach. Anyone?
Also, tagging.
Comment #47
JacineHere's the issue I was referring to regarding theme_links(): #1203908: Add a type parameter to theme_links
Comment #48
aspilicious CreditAttribution: aspilicious commentedAfter a discussion with the html5 team we decided to go for simplicity here. That means we are going to add the navaigation role and replace the outer div with a nav elemebt. (like in patch #30)
Reuploading now.
This patch is way easier to review, everyone can do it!
Comment #49
jessebeach CreditAttribution: jessebeach commentedLooks great. Works as well. Thank you for removing the tag-inflected selectors.
I'm marking this as RTBC. I don't see any risk in committing this and it improves the semantics of the HTML and the clarity of the CSS around the toolbar.
Comment #50
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks all. Glad to see more HTML5-ification. :)