Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28867 closed defect (bug) (fixed)

Correctly label forms in wp_list_table

Reported by: joedolson Owned by: wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Administration Keywords: has-patch needs-docs
Focuses: accessibility Cc:


Adds labels to current page selector and bulk actions select field so that screen readers have an explicit label for those fields.

Passes $which to bulk_actions method in class-wp-list-table.php and in class-wp-plugins-list-table.php so that IDs on top and bottom forms are unique.

Attachments (2)

28867.patch (2.4 KB) - added by joedolson 6 years ago.
Labels for wp_list_table inputs
28867.2.patch (562 bytes) - added by jwenerd 6 years ago.

Download all attachments as: .zip

Change History (14)

6 years ago

Labels for wp_list_table inputs

#1 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 4.0

#2 @obenland
6 years ago

  • Keywords has-patch added

#3 @wonderboymusic
6 years ago

  • Keywords needs-docs needs-refresh added

Every subclass of WP_List_Table needs $which in the method signature for ->bulk_actions()

#4 @wonderboymusic
6 years ago

oops - nevermind, I was looking at ->get_bulk_actions()

#5 @wonderboymusic
6 years ago

  • Keywords needs-refresh removed

#6 @wonderboymusic
6 years ago

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

In 29294:

Adds <label>s to current page selector and bulk actions <select> field so that screen readers have an explicit label.

Props joedolson.
Fixes #28867.

#7 @ocean90
6 years ago

In 29308:

Add missing screen-reader-text CSS class in [29294].

see #28867.

#8 @tivnet
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

bulk_actions( $which ) - the parameter was added without a default value. Old code fails with

Warning: Missing argument 1 for WP_List_Table::bulk_actions()

6 years ago

#9 @jwenerd
6 years ago

Added a patch which passed empty string as default argument to WP_List_Table::bulk_actions()

Does empty string good for this or is something else more sensible as the default argument?

#10 @DrewAPicture
6 years ago

  • Status changed from reopened to reviewing

@wonderboymusic: I hesitate to signify $which as optional, though I don't have a good solution for back-compat + guaranteeing it holds the value expected. Suggestions?

Side note: I'm happy to write inline docs wherever needed.

#11 @joedolson
6 years ago

I don't know that there's a ready way to guarantee that it holds the value expected; but I think that having it optional is at least reasonable, since we need to pass something.

If it's optional and not supplied, the inputs will potentially be invalidly labeled due to a repetitive ID value. This would still leave them better labeled than they were prior to this patch, and would not be a regression for old code -- since old code was in an environment that was never correctly labeled in the first place.

Speaking for myself, I think that having the variable be optional is the best option we have right now, and I would accept it.

#12 @wonderboymusic
6 years ago

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

[29440] missed the ticket.

Note: See TracTickets for help on using tickets.