WordPress.org

Make WordPress Core

Opened 12 months ago

Closed 6 weeks ago

#24098 closed enhancement (fixed)

Support for HTML5 roles

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

Description

I was going through http://core.svn.wordpress.org/trunk/wp-includes/kses.php 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 9 months ago.
Added role to global attributes

Download all attachments as: .zip

Change History (10)

comment:1 SergeyBiryukov12 months ago

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

comment:2 kraftbj11 months 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. ( http://www.w3.org/TR/wai-aria/roles ).

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.

comment:3 mikecorkum9 months ago

I added the the role attribute to all values. This seems a little ridiculous but but according to W3C Section 3.2.7.1 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?

comment:4 kraftbj9 months 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?

mikecorkum9 months ago

Added role to global attributes

comment:5 mikecorkum9 months 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.

comment:6 mikecorkum9 months ago

  • Keywords has-patch added; needs-patch removed

comment:7 DrewAPicture9 months ago

  • Cc xoodrew@… added

comment:8 nacin3 months 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.

comment:9 nacin6 weeks 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.