[wp-trac] [WordPress Trac] #35566: Remove title attributes: Tag cloud widget uses title to display topic count
WordPress Trac
noreply at wordpress.org
Sun Mar 12 18:18:16 UTC 2017
#35566: Remove title attributes: Tag cloud widget uses title to display topic count
---------------------------------------+--------------------------------
Reporter: adamsoucie | Owner: afercia
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.8
Component: Widgets | Version:
Severity: normal | Resolution:
Keywords: has-patch has-screenshots | Focuses: ui, accessibility
---------------------------------------+--------------------------------
Changes (by afercia):
* keywords: has-patch needs-refresh has-screenshots => has-patch has-
screenshots
* milestone: Future Release => 4.8
Comment:
The new patch proposes a new approach based on some of the points
discussed in the Slack conversation linked above and the work done by
@emirpprime, @MikeLittle, and @adamsoucie, trying to get the best of both
worlds.
By default, there are no visual changes other then the removal of the
`title` attribute.
- removes the `title` attribute
- no additional CSS required
- no `screen-reader-text` required, so it doesn't introduce visual changes
in old themes that don't support the `screen-reader-text` CSS class
- adds an option in the widget to display the counts, consistently with
what other widgets already do (Archives, Categories), see screenshots
below
- uses an `aria-label` attribute to match the information conveyed
visually with the one exposed to assistive technologies
- changes the strings `'%s topic', '%s topics'` to `'%s item', '%s
items'`: the tag cloud can be used for any taxonomy not just Tags so
"topic" isn't appropriate
- forces `role="list"` on the tags list, see inline comment
- adds a couple of CSS classes to make styling easier
- `topic_count_text` and `topic_count_text_callback` still work and
they're used for the aria-label `$formatted_count` string
'''Things to consider:'''
Maybe build the strings and escape at a later stage.
Ideally, the tag cloud should be an unordered list `<ul>` but I think we
shouldn't force the `list` format as in the previous patches; that would
require to print out some inline stylesheet (I guess there's consensus
that it should be avoided). Also, the tag cloud is used in several places,
for example in the tags meta box and in Press This. A better option would
be passing the format argument on a case by case basis instead of forcing
the `list` format by default.
I'd say this should be definitely done for the tag meta box and Press
This. I'd recommend that also the bundled themes should use the `list`
format to show best practices to theme authors. These issues should be
addressed in new, separate, tickets.
Maybe add an option to sort tags by number of items. There are already the
`orderby` (name, count, and the `tag_cloud_sort` filter) and the `order`
(ASC, DESC, and RAND) arguments for that. To discuss: whether this should
be a front-end control, or a new option in the widget settings, or both.
Screenshots:
The new option in the Widget settings:
[[Image(https://cldup.com/nUScjPEMkI.png)]]
Twenty Seventeen: Tag Cloud, Archives, and Categories displaying the
counts
[[Image(https://cldup.com/LzwGYAmvd0.png)]]
Twenty Sixteen: Tag Cloud with same font-size tags and styled counts
[[Image(https://cldup.com/ieow1nf9rJ.png)]]
Twenty Eleven: Tag Cloud with different font-size tags and styled counts
[[Image(https://cldup.com/xEzE8S1zWJ.png)]]
Aria label in action
[[Image(https://cldup.com/EDc7IgMBY5.png)]]
Worth noting the counts in other widgets would need some a11y
improvements:
[[Image(https://cldup.com/8M4LHKqtAn.png)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35566#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list