Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#24098 closed enhancement (fixed)

Support for HTML5 roles

Reported by: aniketpant's profile aniketpant Owned by: nacin's profile nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.5
Component: Formatting Keywords: 2nd-opinion has-patch
Focuses: accessibility Cc:


I was going through and I realized that most of the new HTML5 tags have been introduced but role is a missing attribute.

I feel that since WordPress has already made a move towards HTML5 by supporting <article>, <section> and other tags, all attributes should be made available too. role should be added to the required tags falling under $allowedposttags.

Go through the link for more information on roles.

Attachments (1)

24098.diff (310 bytes) - added by mikecorkum 10 years ago.
Added role to global attributes

Download all attachments as: .zip

Change History (10)

#1 @SergeyBiryukov
11 years ago

  • Component changed from General to Formatting
  • Version changed from trunk to 3.5

#2 @kraftbj
11 years ago

  • Cc bk@… added
  • Component changed from Formatting to Accessibility

I think this is better classified as a Accessibility component as the role attribute since it is in the HTML5 spec as coming from the WAI-ARIA spec. ( ).

To that end, it should be added to $allowedposttags, likely in 3.7. I'll work up a patch when 3.6 drops, if no one else does before.

#3 @mikecorkum
10 years ago

I added the the role attribute to all values. This seems a little ridiculous but but according to W3C Section any HTML element should be able to use role. Perhaps this isn't realistic, and we should just apply it to the elements that commonly have a role defined. Thoughts?

#4 @kraftbj
10 years ago

My apologies Mike if I led you astray on my last comment. If we're going to add it to all HTML, should it go in $global_attributes instead (in the _wp_add_global_attributes() at the end of kses.php instead?

It makes sense to me to add it there—you want to take it?

10 years ago

Added role to global attributes

#5 @mikecorkum
10 years ago

I totally agree, that makes WAY more sense - I didn't even know that was there. See the updated diff, i've made the change.

#6 @mikecorkum
10 years ago

  • Keywords has-patch added; needs-patch removed

#7 @DrewAPicture
10 years ago

  • Cc xoodrew@… added

#8 @nacin
10 years ago

  • Component changed from Accessibility to Formatting
  • Focuses accessibility added
  • Milestone changed from Awaiting Review to 3.9

Seems OK to me. We will want to confirm there are no security implications of this.

#9 @nacin
10 years ago

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

In 27388:

Allow the role attribute in kses for all elements.

props mikecorkum.
fixes #24098.

Note: See TracTickets for help on using tickets.