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.
Follow-up to #2052473: Add aria-label or aria-describedby attributes to all <nav> elements
+++ b/core/includes/theme.inc
@@ -2135,6 +2135,7 @@ function template_preprocess_page(&$variables) {
'class' => array('visually-hidden'),
+ 'attributes' => array('id' => 'links__system_main_menu'),
@@ -2146,6 +2147,7 @@ function template_preprocess_page(&$variables) {
'class' => array('visually-hidden'),
+ 'attributes' => array('id' => 'links__system_secondary_menu'),
We should move the class into the attributes array here as $header['class'] is effectively deprecated for consistency.
Task | Novice task? | Contributor instructions | Complete? |
---|---|---|---|
Reroll the patch if it no longer applies. | Yes | Instructions | |
Manually test the patch | Yes | Instructions | |
Embed before and after screenshots in the issue summary | Yes | Instructions |
Comment | File | Size | Author |
---|---|---|---|
#14 | Screen Shot 2014-08-30 at 15.24.09.png | 189.78 KB | lauriii |
#12 | 2285493-class-property-deprecated-12.patch | 3.63 KB | lanchez |
#7 | 2285493-class-property-deprecated-7.patch | 2.94 KB | joelpittet |
#1 | 2285493-class-property-deprecated-1.patch | 3.07 KB | joelpittet |
Comments
Comment #1
joelpittetHere's an attempt to remove the class property from links and use attributes.class instead.
Comment #2
star-szrI think this would need a small change record. Looks good at a glance.
Comment #3
joelpittetDrafted
https://drupal.org/node/2286175
Comment #4
lauriiiComment #7
joelpittetRe-roll
Comment #8
peezy CreditAttribution: peezy commentedMe and my colleague can't get the patch to apply cleanly, so we're submitting for retesting.
Comment #10
joelpittet@peezy seems to still pass and apply here. You are trying to apply it from your drupal root on 8.0.x branch?
This command if you have git checked out 8.0.x branch
curl https://www.drupal.org/files/issues/2285493-class-property-deprecated-7.patch | git apply --index
Comment #11
star-szrWhen reviewing this more thoroughly I noticed that the menu_tree theme hook has this same pattern. This issue can be expanded to include that or we can create a separate issue to tackle menu_tree. I am leaning towards handling both here and tweaking the change record to include both.
The changes in template_preprocess_page() here are actually for menu_tree render arrays so if this issue ends up being for just #theme links those changes need to be removed from the patch. The changes in \Drupal\system\Tests\Theme\FunctionsTest are good for #theme links though.
Comment #12
lanchez CreditAttribution: lanchez commentedI just removed the backwards compatibility in template_preprocess_menu_tree. Tests seems to be fine in local environment so it might not be used anymore? This was basically what this https://www.drupal.org/node/2310341 issue was aimed for. Lets see what full tests shows.
Comment #13
joelpittetI'm ok with putting them both in this issue. Thanks for patch @lanchez!
Comment #14
lauriiiTested this manually and it doesn't break anything.
Comment #15
star-szrThis looks good! Tweaking the title and I updated the change record to encompass both.
Comment #16
Sutharsan CreditAttribution: Sutharsan commentedAnd what about the below code from template_preprocess_link()?
It was added there in #98696-51: Various bugs in theme_links()
Comment #17
star-szrGreat, didn't know about that one. Let's grab that here too, then.
Comment #18
lauriiiI'm sorry but am I missing something? isn't that already removed in the patch #12?
Comment #19
Sutharsan CreditAttribution: Sutharsan commented@lauriii, you are right. I overlooked it in the patch.
Comment #20
star-szrAh ok, I thought it was link vs. links. Posted from my phone. Carry on :)
Comment #21
alexpottCommitted b48d098 and pushed to 8.0.x. Thanks!
Changes like this are super annoying because I have to work out that actually nothing has changed.
Comment #23
hass CreditAttribution: hass commentedLooks like a good code style bug fix. :-)