#55530 closed enhancement (fixed)
Category archive links include description in a title attribute by default
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | title-attribute good-first-bug has-patch commit add-to-field-guide |
| Focuses: | accessibility | Cc: |
Description (last modified by )
As aria should help people that need assistive technology, having them to listen to a whole heap of crumbled words that come from a html structured category description isn't what this was intendend for.
<li class="cat-item cat-item-1 current-cat"><a aria-current="page" href="https://www.blog.com" title="Here comes everything from the category description with stipped html tags which results in a lot of words that don't give the user of assistive technology a benefit. It even disturbs him (when categories have long / formatted descriptions. The words here show up without formatting and created duplicate content on page">*</a>
Attachments (4)
Change History (22)
#1
@
4 years ago
- Component changed from General to Taxonomy
- Description modified (diff)
- Focuses accessibility added
- Keywords needs-patch title-attribute added
- Type changed from defect (bug) to enhancement
- Version 5.9.2 deleted
#4
@
4 years ago
- Summary changed from In widget area <a aria-current="page" title="shows whole category description when only cat_title should be shown - which breaks the intended benefit of aria (and creates duplicate content on the category archive)" to Category archive links include description in a title attribute by default
#6
@
4 years ago
Hello @sabernhardt, I'd like to tackle this as my first bug.
Can you help me brainstorm the best solution, please?
Currently, the default value of use_desc_for_title is 1.
If I set it to 0, then the HTML <a> tag will have no title attribute at all.
- Should we remove that default arg, then we'll never have the <a>
titleattribute - Should we change the behavior of \src\wp-includes\class-walker-category.php:125 to simply use
$category->nameifuse_desc_for_titleis 1, but that simply sounds wrong - Should we add an
} else {there so we always have thetitleattribute in the <a> tag, with the$category->descriptionifuse_desc_for_titleis 1 and$category->nameifuse_desc_for_titleis 0
I guess the last solution would work, what do you think?
@
4 years ago
Default use_desc_for_title set to false (0), category walker will always create <a title=""> attribute with category name (default) or category description if use_desc_for_title is set to true (1)
#8
@
4 years ago
Thanks for the patch!
I could have linked to #24766 to explain why many title attributes have been removed. Plus, the category name is already used in the link text, so adding the same in a title attribute would be redundant.
#9
follow-up:
↓ 10
@
4 years ago
Ok, thank you for the additional information.
The latest diff changes the default value to false (0) which means no title attribute.
If someone needs the title they can change the $args value to true (1) and if they need to manipulate it there's a filter in the category Walker.
I guess this was the shortest possible diff .)
#10
in reply to:
↑ 9
@
4 years ago
- Milestone changed from Awaiting Review to 6.0
I guess this was the shortest possible diff
Almost :) The docblock needs updating as well (it says "Default 1.")
This ticket was mentioned in PR #2705 on WordPress/wordpress-develop by audrasjb.
3 years ago
#13
Trac ticket: https://core.trac.wordpress.org/ticket/55530
#14
@
3 years ago
- Owner set to audrasjb
- Status changed from new to reviewing
Thanks for the patch!
I added a PR to make sure it passes Core unit tests.
Self assigning for final review/commit.
3 years ago
#17
committed in https://core.trac.wordpress.org/changeset/53392
Thanks for the report!
WordPress has removed many title attributes, but the wp_list_categories function still has
use_desc_for_titletrue (1) by default. I don't think this should be the expected default.