Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#26160 closed enhancement (fixed)

More semantic markup for the post formats metabox

Reported by: tsiger's profile tsiger Owned by: obenland's profile obenland
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.7
Component: Post Formats Keywords: has-patch commit
Focuses: ui, accessibility, administration Cc:


I think there is room for improvement in the markup used to populate the post formats list in the metabox which currently looks like:

Instead of using a div as a container and br tags to keep things in place as a list I replaced the div with ul and put every post format item within a li and now looks like:

I think it's semantically better now (it's a list of items after all). Checked the appearance in all major browsers (RTL too) and looks the same.

Also it is easier now for someone to target with CSS only a specific post format radio button and possible apply some extra styles to its container (li).

Attachments (3)

meta-boxes.php.patch (2.0 KB) - added by tsiger 11 years ago.
26160.patch (1.2 KB) - added by joedolson 9 years ago.
Use fieldset/legend.
26160.2.patch (1.2 KB) - added by afercia 9 years ago.

Download all attachments as: .zip

Change History (19)

#1 @tsiger
11 years ago

  • Summary changed from Proposed HTML changes for the post formats metabox in the Add to Proposed HTML changes for the post formats metabox

#2 @SergeyBiryukov
11 years ago

  • Version changed from trunk to 3.7

#3 @helen
9 years ago

  • Focuses ui accessibility administration added

Would like to hear from a11y folks if this is helpful, hurtful, or doesn't matter for screen readers and anything else that might be impacted by the markup change.

#4 @joedolson
9 years ago

I'm not sure it makes a huge difference. It means that screen reader users will probably get notified twice about the number of items in the list - with radio button groups, screen readers generally indicate how many items there are in the radio button group; they also announce how many items are in a list.

I'd like a second opinion on this - I'm going both ways on it: it is a more semantic choice to have this in a list, but it also means that essentially redundant information is being announced for screen reader users. From a usability perspective, I think it makes the experience worse.

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

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

9 years ago

#6 follow-up: @rianrietveld
9 years ago

Why not use as container a fieldset, remove the <br> and let the css decide the layout (inline-block/block). Adding an extra layer of HTML seems not necessary to me, you can style it any way you want, and don't need a <ul> for that.

#7 in reply to: ↑ 6 @afercia
9 years ago

Replying to rianrietveld:

Why not use as container a fieldset, remove the <br>

+1 for a fieldset, with a nice, screen-reader-text'ed legend too :). Screen readers will read out the legend as "{legend text} grouping", or similar.

#8 @helen
9 years ago

  • Keywords has-patch removed

@rianrietveld @afercia Do you feel that we need to make changes to this specific metabox, as in would you consider the fieldset suggestion to be necessary?

#9 @afercia
9 years ago

@helen, fieldset + legend would be a nice addition. Without them users land on these radio buttons and hear just "video", "audio", etc. with no clue what that actually means. With no initial clue, at least :) With a fieldset+legend they would hear "{legend text} grouping". Press This already uses:

<fieldset><legend class="screen-reader-text"><?php _e( 'Post formats' ); ?></legend>

#10 @helen
9 years ago

  • Keywords needs-patch added
  • Summary changed from Proposed HTML changes for the post formats metabox to More semantic markup for the post formats metabox

9 years ago

Use fieldset/legend.

#11 @joedolson
9 years ago

  • Keywords has-patch added; needs-patch removed

9 years ago

#12 @afercia
9 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.3

Rebuilt the patch from the root, also removed the last useless <br />. It's a small change and at the same time gives us better semantics, improved accessibility and consistency with Press This. I'm all for it, would propose for commit consideration.

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

9 years ago

#14 @afercia
9 years ago

  • Owner set to davidakennedy
  • Status changed from new to assigned

#15 @obenland
9 years ago

  • Owner changed from davidakennedy to obenland
  • Status changed from assigned to accepted

#16 @obenland
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 32720:

More semantic markup for the post formats metabox.

Screen readers will now introduce the group of radio buttons.
Also brings the meta box to parity with Press This.

Props joedolson, afercia.
Fixes #26160.

Note: See TracTickets for help on using tickets.