The $secondary_links defaults to using the User menu's links in D7. But Drupal core still defaults to using "Secondary menu" as the accessible heading for those links. This is completely inaccurate. So much for accessibility!

The best solution I can think of is to query for the actual menu used for the $secondary_links and use that menu's title as the heading.

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Reroll the patch if it no longer applies. Instructions
Add automated tests Instructions
Manually test the patch Novice Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions
CommentFileSizeAuthor
#97 Screen Shot 2014-09-28 at 8.43.20 AM.png96.61 KBmgifford
#95 drupal-secondary-links-1079010-95.patch1.41 KBBarisW
#93 drupal-secondary-links-1079010-93.patch1.37 KBBarisW
#89 drupal-secondary-links-1079010-89.patch1016 bytespgautam
#85 drupal-secondary-links-1079010-85.patch1013 bytescilefen
#85 interdiff-83-85.txt652 bytescilefen
#83 drupal-secondary-links-1079010-83.patch988 bytesJalandhar
#81 drupal-secondary-links-1079010-81.patch1.05 KBJalandhar
#80 drupal-secondary-links-1079010-80.patch1.05 KBJalandhar
#75 Secondary-Menu-After.png147.2 KBmgifford
#75 Secondary-Menu-Before.png127.81 KBmgifford
#74 drupal-secondary-links-1079010-73.patch1.09 KBer.pushpinderrana
#64 secondary_links_heading-1079010-64.patch1.03 KBmgifford
#60 secondary_links_heading-1079010-60.patch1 KBmgifford
#56 secondary_links_heading-1079010-56.patch1.26 KBmgifford
#47 secondary_links_heading-1079010-47.patch1.26 KBmparker17
#45 secondary_links_heading-1079010-45.patch1.28 KBmparker17
#35 User account menu.png228.49 KBmgifford
#33 secondary_links_heading-1079010-33.patch5.22 KBmparker17
#29 secondary_menu_heading-1079010-29.patch5.22 KBAlbert Volkman
#26 secondary_heading.patch5.2 KBdroplet
#22 secondary_heading.patch4.47 KBdroplet
#20 secondary_heading.patch4.34 KBdroplet
#18 secondary_menu_heading-1079010-18.patch1.82 KBAlbert Volkman
#14 1079010-secondary-menu-heading-13.patch2.35 KBmgifford
#9 1079010-secondary-menu-heading-9.patch3.11 KBmgifford
#6 1079010-secondary-menu-heading2.patch3.54 KBmgifford
#3 1079010-secondary-menu-heading.patch4.27 KBJohnAlbin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Everett Zufelt’s picture

I think you're right. Please, please, I'm hoping that all menus will be blocks in D8 and we can get rid of these.

JohnAlbin’s picture

Status: Active » Fixed
Issue tags: +Accessibility

Agreed. All menus as blocks in D8 will be a big improvement.

Ok. Fixed in Zen. http://drupalcode.org/project/zen.git/commit/551c313

JohnAlbin’s picture

Project: Zen » Drupal core
Version: 7.x-3.x-dev » 7.x-dev
Component: CSS/HTML markup » user interface text
Status: Fixed » Needs review
FileSize
4.27 KB

Moving to core.

I'm working on this issue over in http://drupalcode.org/sandbox/johnalbin/1074382.git/shortlog/refs/heads/...

Here's the patch. I'm not 100% certain this text is translatable. I admit to not understanding how you are supposed to translate text that is input into admin forms and stored in the database. t() is problematic, apparently?

Status: Needs review » Needs work

The last submitted patch, 1079010-secondary-menu-heading.patch, failed testing.

bowersox’s picture

+1. I support this title change. The patch had some unrelated .htaccess changes, but otherwise the approach looks good.

Regarding translation, my philosophy is that user-provided content is not subject to translation with t(). We simply output user-entered content in the language in which it was entered. Right?

mgifford’s picture

Hope this patch passes the bot. I edited it to cut out the .htaccess info so hopefully it applies.

yoroy’s picture

Status: Needs work » Needs review

bot?

Status: Needs review » Needs work

The last submitted patch, 1079010-secondary-menu-heading2.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
3.11 KB

Thanks for prodding the bot yoroy. Hopefully this works better this time.

Status: Needs review » Needs work

The last submitted patch, 1079010-secondary-menu-heading-9.patch, failed testing.

Everett Zufelt’s picture

Marked #878772: Primary and Secondary links headings are hard coded as duplicate, as this issue has some code.

Issue summary from #878772: Primary and Secondary links headings are hard coded:

In D7 we added H2 headings to theme_links because "Headings should be used on navigation menus and any list of links that consistently appears on multiple
pages."
1.

At the moment the headings for the Main and Secondary menus are hard coded which is OK if those are in fact what you require, if not then its less than
idea - the heading should be the name of the source menu so it has meaning in the context of the users site.

And comment from David_Rothstein

Hm. Looking into this more, I'm not so convinced we want to change those headings to be dynamic after all.

Primary/secondary links are just a list of links. They are derived from "skimming" the top set of links off of a menu, but they are not themselves a complete
menu. And currently (unlike when a menu is displayed in a block) we never display the menu title to anyone within the primary/secondary links.

So if we start making it display to screen readers, that could have unexpected results. For example, the menu title might be something that only makes sense
to administrators and that they never intended or expected an end user to see (!).

The way it is now is indeed confusing, but I think that's just a duplicate of
#698014: Theme settings for main/secondary variables mismatch with menu settings With that issue, we would switch to having the headings say something like "main links" and "secondary links" (rather than "main menu" and "secondary menu")
which would accurately describe to screen readers what they are and their relation to the overall site. Currently, the headings are very confusing, but
correct - because Drupal 7 is using the phrases "main menu" and "secondary menu" to refer to these links in the admin interface also. I don't think we
can fix them in isolation.

Maksym Kozub’s picture

And comment from David_Rothstein

...And currently (unlike when a menu is displayed in a block) we never display the menu title to anyone within the primary/secondary links.

Do you (and David) mean the title of a source menu from which those links are taken, or do you mean something else? There are titles at least in Stark, and those titles are (hard-coded) "Main menu" and "Secondary menu".

sun’s picture

Version: 7.x-dev » 8.x-dev
Component: user interface text » system.module
mgifford’s picture

Status: Needs work » Needs review
FileSize
2.35 KB

Re-rolling the patch.

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, 1079010-secondary-menu-heading-13.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, 1079010-secondary-menu-heading-13.patch, failed testing.

Albert Volkman’s picture

Status: Needs work » Needs review
FileSize
1.82 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, secondary_menu_heading-1079010-18.patch, failed testing.

droplet’s picture

Assigned: Unassigned » droplet
Status: Needs work » Needs review
FileSize
4.34 KB

Status: Needs review » Needs work

The last submitted patch, secondary_heading.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
4.47 KB

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, secondary_heading.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review

#22: secondary_heading.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, secondary_heading.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
5.2 KB

fix search module tests

mgifford’s picture

Issue tags: -Accessibility

#26: secondary_heading.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, secondary_heading.patch, failed testing.

Albert Volkman’s picture

Status: Needs work » Needs review
FileSize
5.22 KB

Re-roll to account for template location change.

mgifford’s picture

Issue tags: +a11ySprint

tagging.

mgifford’s picture

Issue tags: -Accessibility, -a11ySprint

Status: Needs review » Needs work
Issue tags: +Accessibility, +a11ySprint

The last submitted patch, secondary_menu_heading-1079010-29.patch, failed testing.

mparker17’s picture

Status: Needs work » Needs review
FileSize
5.22 KB

Hmm... looks like the user-menu menu has been renamed to account.

Also fixing a missing space.

Re-rolling.

mgifford’s picture

mgifford’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
228.49 KB

Looks good. It's finally showing the proper menu:
<h2 class="element-invisible">User account menu</h2>

sun’s picture

Status: Reviewed & tested by the community » Needs review

I think we should close this issue as won't fix or duplicate of #1869476: Convert global menus (primary links, secondary links) into blocks - which apparently removes this custom primary/secondary menu links markup generation entirely.

David_Rothstein’s picture

Also, I think the issue I raised that is linked to in #11 is still relevant here; why should we start exposing a potentially admin-facing menu name to end users of the site?

The only extra information that a sighted user has here which a screen reader user does not is that the visual cues on the page indicate this menu is of secondary importance in the navigation structure.... they do not have any information about the stored title. Therefore, I still think "Secondary X" should always be an appropriate screen reader label for it. (As mentioned earlier, though, "menu" may not really be an appropriate word for the X.)

mgifford’s picture

I'm not opposed to that. However, what happens if that patch doesn't get in?

droplet’s picture

Assigned: droplet » Unassigned
mgifford’s picture

Issue tags: -Accessibility, -a11ySprint
mgifford’s picture

mparker17’s picture

Status: Needs review » Needs work
Issue tags: +Accessibility, +a11ySprint

The last submitted patch, secondary_links_heading-1079010-33.patch, failed testing.

mgifford’s picture

Ok, this needs to be re-written in twig now.

What happens to the code in core/includes/theme.inc

Gotta wrap my head around this new templating system.

mparker17’s picture

The old patch did not apply anymore so I don't have an interdiff.

Here are some notable changes:

  • The "Block test theme" test is now at core/modules/block/tests/themes/block_test_theme/block_test_theme.info.yml, but it doesn't seem to exist anymore? Certainly it doesn't have it's own template file.
  • The SearchConfigSettingsFormTest doesn't need to be changed anymore.
  • The call to the theme('links'... function previously in the page templates is now done at the bottom of template_preprocess_page(), so no changes needed to be made to the page template files.

I've manually tested this patch by changing which menu is currently selected as the "secondary menu" at admin/structure/menu/settings and changing the name of the currently-selected secondary menu, and confirmed that the markup changes correctly.

I did not see an automated test in the previous patch for this feature: does anyone know if there is one? I can add one if not.

mparker17’s picture

Status: Needs work » Needs review

Whoops.

mparker17’s picture

Rats, had unstaged changes. The patch from #45 probably won't work; but the notes there are still valid. Try again.

Status: Needs review » Needs work
Issue tags: -Accessibility, -a11ySprint

The last submitted patch, secondary_links_heading-1079010-47.patch, failed testing.

mparker17’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Accessibility, +a11ySprint

The last submitted patch, secondary_links_heading-1079010-47.patch, failed testing.

mparker17’s picture

Status: Needs work » Needs review

The secondary links heading shouldn't affect the search config form or unmanaged remote file deletion. Let's try this again.

mparker17’s picture

Issue tags: -Accessibility, -a11ySprint

Status: Needs review » Needs work

The last submitted patch, secondary_links_heading-1079010-47.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Accessibility, +a11ySprint

The last submitted patch, secondary_links_heading-1079010-47.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
1.26 KB

Just an update from #47.

Status: Needs review » Needs work
Issue tags: -Accessibility, -a11ySprint

The last submitted patch, secondary_links_heading-1079010-56.patch, failed testing.

dcrocks’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Accessibility, +a11ySprint

The last submitted patch, secondary_links_heading-1079010-56.patch, failed testing.

mgifford’s picture

Re-rolled.. Although I also nested the code within an existing if statement since that's the only place it seems to be used. Should help performance.

mgifford’s picture

Status: Needs work » Needs review

It should all be within if (!empty($variables['secondary_menu'])) { now.

Status: Needs review » Needs work
Issue tags: -Accessibility, -a11ySprint

The last submitted patch, secondary_links_heading-1079010-60.patch, failed testing.

mgifford’s picture

Issue summary: View changes
Issue tags: +Novice
FileSize
1.03 KB

re-roll.

mgifford’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 64: secondary_links_heading-1079010-64.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
LinL’s picture

Status: Needs review » Needs work
droplet’s picture

Jalandhar’s picture

Assigned: Unassigned » Jalandhar
Jalandhar’s picture

Assigned: Jalandhar » Unassigned
mgifford’s picture

@Jalandhar Drat.. I was hoping you'd get to fixing the tests. What stopped you from producing a new patch?

Jalandhar’s picture

@mgifford : Actually, I was not sure about few things in the failing tests and more over I was working on other tickets. Unassigned so that someone else can pick this up in the meanwhile

er.pushpinderrana’s picture

Assigned: Unassigned » er.pushpinderrana
Status: Needs work » Needs review
FileSize
1.09 KB

Checked for active menu for current page in this patch.

mgifford’s picture

Ok, so I can see that with the patch the 2ndary menu is looking better.

But when I change the name of the menu to something other than "User account menu" it still comes out as:
<h2 id="links__system_secondary_menu" class="visually-hidden">User account menu</h2>

I really don't think this is related to this patch, but wanted to flag it as a concern before marking it RTBC.

cilefen’s picture

Issue summary: View changes
cilefen’s picture

Issue tags: +Needs tests

Status: Needs review » Needs work

The last submitted patch, 74: drupal-secondary-links-1079010-73.patch, failed testing.

Jalandhar’s picture

Patch #74, no longer applies.

Here is the update for the patch.

Jalandhar’s picture

Status: Needs work » Needs review
FileSize
1.05 KB

Status: Needs review » Needs work

The last submitted patch, 81: drupal-secondary-links-1079010-81.patch, failed testing.

Jalandhar’s picture

Status: Needs work » Needs review
FileSize
988 bytes

Another try at the patch.

Status: Needs review » Needs work

The last submitted patch, 83: drupal-secondary-links-1079010-83.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
FileSize
652 bytes
1013 bytes

module_exists() is deprecated.

Status: Needs review » Needs work

The last submitted patch, 85: drupal-secondary-links-1079010-85.patch, failed testing.

mgifford’s picture

Issue tags: +Needs reroll

No longer seems to apply.

pgautam’s picture

Assigned: er.pushpinderrana » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1016 bytes

Rerolled patch.

mgifford’s picture

Status: Needs review » Needs work

I completely changed the menu here:
http://sfe2853d5ccc8e91.s2.simplytest.me/

In admin/structure/menu/settings I set a different menu to be the Source for the Secondary links.

After clearing cache I still have the User account menu header <h2 id="links__system_secondary_menu" class="visually-hidden">User account menu</h2> even when it's for the footer menu.

Similar problem as in #75 when you change the name of the menu to something other than "User account menu" it doesn't show up in the header.

mgifford’s picture

Issue tags: +dcamsa11y
BarisW’s picture

Assigned: Unassigned » BarisW
Status: Needs work » Active

Fixed it locally, will add a patch tomorrow.

BarisW’s picture

Assigned: BarisW » Unassigned
Status: Active » Needs review
FileSize
1.37 KB

This should nail it. While at it, I found out that this goes wrong for primary links too. The use case is limited, but one is able to change the source of the main menu. Then, the heading should reflect this too, just as with the secondary links. This patch fixes both.

Status: Needs review » Needs work

The last submitted patch, 93: drupal-secondary-links-1079010-93.patch, failed testing.

BarisW’s picture

Status: Needs work » Needs review
FileSize
1.41 KB

It now uses the site config, so the labels are translatable too.

BarisW’s picture

Issue tags: +Amsterdam2014
mgifford’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
96.61 KB

This looks great. It now follows the value of the secondary menu! Tested this on SimplyTest.me.

Screenshot of secondary menu with source

lokapujya’s picture

Status: Reviewed & tested by the community » Active

The comment in #37 seems legit. Sounds like the hardcoded name is actually the more useful label.

mgifford’s picture

Status: Active » Needs work
Issue tags: +Needs reroll

@lokapujya - Right now you can edit the "Main navigation" text so that an administrator could provide different information to a screen reader user through the UI. This isn't possible at the moment for the "Secondary navigation".

It is possible that "Secondary navigation" is more descriptive than the actual name of the menu, but since you can't change it now without adjusting the theme, it's kinda limiting.

@David_Rothstein's always got interesting/useful comments and #37 is no exception.

"why should we start exposing a potentially admin-facing menu name to end users of the site?"

The Main menu name is editable (as a block), so this isn't really new.

"The only extra information that a sighted user has here which a screen reader user does not is that the visual cues on the page indicate this menu is of secondary importance in the navigation structure"

Adding the name of the menu is more semantic. Adding more queues than are available to sighted users shouldn't be seen as a problem.

mgifford’s picture

Status: Needs work » Closed (duplicate)
Issue tags: -Needs reroll
Related issues: +#1869476: Convert global menus (primary links, secondary links) into blocks

Just looking at #36 actually where @sun suggests this might not be needed due to #1869476: Convert global menus (primary links, secondary links) into blocks. And indeed it is!

Both menu headings can be edited now without this patch. Thanks everyone for their work on this patch.

mgifford’s picture

Issue tags: -Novice, -Needs tests