Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#30144 closed defect (bug) (fixed)

Twenty Fourteen: Add aria-hidden to reduce verbosity on archive pages

Reported by: joedolson's profile joedolson Owned by: lancewillett's profile lancewillett
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch commit
Focuses: accessibility Cc:

Description (last modified by joedolson)

Archive images are currently duplicate links to post singular; apply aria-hidden so image link is ignored on archive pages.

See #30076 for history on patch.

Attachments (2)

30144.patch (773 bytes) - added by joedolson 9 years ago.
aria-hidden
30144.2.diff (744 bytes) - added by hiwhatsup 9 years ago.
original patch plus formatting fixed.

Download all attachments as: .zip

Change History (12)

@joedolson
9 years ago

aria-hidden

#1 @lancewillett
9 years ago

  • Milestone changed from Awaiting Review to 4.1
  • Summary changed from Add aria-hidden to reduce verbosity on archive pages to Twenty Fourteen: Add aria-hidden to reduce verbosity on archive pages

#2 @lancewillett
9 years ago

  • Keywords reporter-feedback added

Good change, first part of the patch looks good to me, adding the ARIA attribute.

Can you explain the second change? Changing the post thumbnail and adding a title attribute -- what is that for, or why needed?

#3 @hiwhatsup
9 years ago

the_post_thumbnail( 'post-thumbnail', array( 'alt'=>get_the_title() ) ); 

The parameter post-thumbnail seems redundant as post-thumbnail is the default value for size parameter of function the_post_thumbnail(). And second defined parameter overrides the default value for image alt which either returns the attachment except and if empty the attachment title:

In function wp_get_attachment_image() on line 710 if wp-includes/media.php

 if ( empty($default_attr['alt']) )
         $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
          if ( empty($default_attr['alt']) )
                  $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title

Is there a reason for returning the post title in place of the attachment except or title for that image alt?

Last edited 9 years ago by hiwhatsup (previous) (diff)

#4 @joedolson
9 years ago

Yes - the image is linked, so it needs to convey information about the target of the link rather than about the image. The image is also on the target page, so that alt attribute will be provided on that page.

#5 @hiwhatsup
9 years ago

@joedolson, I kind of agree. However, wouldn't make sense to make the second change and add it to a separate ticket on the UI focus so it can be opened up to discussion? Your first change and bug fix seems unrelated to your second change (which seems more like a UI enhancement).

Last edited 9 years ago by hiwhatsup (previous) (diff)

#6 @joedolson
9 years ago

All this ticket was intended to do was clone some changes over from work on Twenty Fifteen; it doesn't seem worth having the discussion again. See #30076 to see the history on the ticket.

If you want to split the patch into two separate tickets, feel free. I don't see the point, particularly. I'm amending the description to add the ticket reference and more detail.

#7 @joedolson
9 years ago

  • Description modified (diff)

@hiwhatsup
9 years ago

original patch plus formatting fixed.

#8 @hiwhatsup
9 years ago

@joedalson, good point. I didn't realize this was already addressed in a separate ticket for twenty fifteen. Given the context I agree with your original fix. I posted your original patch plus I also fixed the formatting.

Version 0, edited 9 years ago by hiwhatsup (next)

#9 @lancewillett
9 years ago

  • Keywords commit added; reporter-feedback removed

Thanks for the explanation. Ideally we'd split these into two tickets -- but we can keep that for next time. ;)

Patch looks good with the formatting fixes, thank you.

#10 @lancewillett
9 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 30387:

Twenty Fourteen: improve post thumbnail HTML output.

  • Add aria-hidden attribute to reduce verbosity on archive pages.
  • Add alt text in archives to avoid confusing link texts, see #30076 for context in Twenty Fifteen.

Props hiwhatsup, joedolson. Fixes #30144.

Note: See TracTickets for help on using tickets.