[wp-trac] [WordPress Trac] #41261: Ensure list table column titles are "clean" when reused in the Screen Options

WordPress Trac noreply at wordpress.org
Thu Jul 6 12:54:21 UTC 2017


#41261: Ensure list table column titles are "clean" when reused in the Screen
Options
----------------------------+-----------------------------
 Reporter:  afercia         |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:  has-screenshots
  Focuses:                  |
----------------------------+-----------------------------
 The list table column "titles" are then reused (except for some "special"
 columns) in the Screen Option tabs, as labels for the Columns checkboxes.
 Ideally, the column titles should be just plain text. However, even
 WordPress uses some HTML for the Comments column title, in order to have a
 nice icon with some screen-reader-text in the table header:

 [[Image(https://cldup.com/S13T1iu4-z.png)]]

 The Comments "display name" gets later cleaned up in a couple places:
 - for the Screen Options, with a hardcoded conditional, see
 https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-
 wp-screen.php?rev=40800&marks=1088#L1062
 - for the `data-colname` attribute used in the responsive view, using
 `wp_strip_all_tags()`, see
 https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-
 wp-list-table.php?rev=40960&marks=1282#L1267

 Plugins might want to do the same thing WordPress does for the Comments
 column and use icons/HTML for their custom column titles. For example:

 [[Image(https://cldup.com/SBp57JkYu2.png)]]

 In this case, while any HTML gets stripped out for the `data-colname`
 attribute, there's no easy way I can think of to clean up the title for
 the Screen Options checkboxes. Maybe worth considering a more solid and
 standardized way to ensure column titles can use custom HTML but also be
 cleaned up for later reuse in other places. Not sure what the best option
 would be. There are probably a few different ones:
 - introduce a standardized way to use some visually hidden (screen-reader-
 text) title for the columns plus HTML to be cleaned up later; this could
 also be done in an accessible way, hiding the HTML content with aria-
 hidden (or providing an option for that)
 - introduce a filter somewhere to clean up the column titles
 - just use `wp_strip_all_tags()` in
 `WP_Screen->render_list_table_columns_preferences()` instead of the
 special case for the Comments column

 Any thoughts welcome!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41261>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list