Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#45102 closed defect (bug) (wontfix)

Accessibility Issue: id attribute value must be unique

Reported by: picru's profile picru Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: accessibility Cc:

Description

We have recently received an accessibility audit and were sited for the class and id attributes being the same. Is it possible to change the way these get generated?

Ex. <article class="post-38007 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized" id="post-38007">

  • Pierre

Change History (7)

#1 @mukesh27
6 years ago

  • Component changed from Post Formats to Posts, Post Types
  • Focuses accessibility added
  • Keywords 2nd-opinion added; ux-feedback needs-patch removed

Hi @picru, Welcome to WordPress Trac! Thank you for your ticket.

Nope, It's perfectly acceptable and not create and accessibility issue.

A class is defined using a . and an ID is defined using a #. So as far as the browser is concerned, they're two totally separate items.

It's probably best practise to keep the names different purely for code readability, but there's no harm in them being the same.

#2 @mukesh27
6 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

#3 @SergeyBiryukov
6 years ago

  • Keywords reporter-feedback added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Hi @picru, welcome to WordPress Trac! Thanks for the report.

Do you have multiple items with id="post-38007" on the same page? Which theme are you using?

#4 @knutsp
6 years ago

(This ticket is not about duplicate id attributes.)

In my Twenty Fifteen theme the article element has identical class and id attribute values. I guess a lot of themes does the same (not checked).

If this is reported as an error by an accessibility audit, then that could be a false positive.

If this is a problem for an assistive tool, however, then the problem is real, but as far as I know and can find, there is no formal restriction on class attributes that say it should not be equal to an id attribute value. Those attributes live in separate name spaces.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


6 years ago

#6 @afercia
6 years ago

  • Keywords close added; dev-feedback 2nd-opinion removed
  • Milestone Awaiting Review deleted
  • Version 4.9.8 deleted

Pending clarification why a css class attribute and an id attribute with the same value are an accessibility issue, e.g.:
class="post-38007 ..." id="post-38007"
To my knowledge, this is not an issue. Proposing to close this ticket but please do feel free to report additional feedback if I'm missing something.

#7 @afercia
6 years ago

  • Keywords reporter-feedback close removed
  • Resolution set to wontfix
  • Status changed from reopened to closed

Closing as there's no evidence this is an accessibility issue. Please do feel free to report additional feedback if I'm missing something.

Note: See TracTickets for help on using tickets.