Opened 8 weeks ago
Closed 3 days ago
#63482 closed enhancement (wontfix)
wp:list does not like additional attributes on ul
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | Editor | Keywords: | close |
Focuses: | accessibility | Cc: |
Description (last modified by )
Adding additional attributes on <ul>
in a wp:list
<!-- wp:list --><ul class="cta wp-block-list" role="menu" aria-orientation="horizontal">
Block contains unexpected or invalid content.
Change History (6)
#1
@
8 weeks ago
- Component changed from General to Editor
- Description modified (diff)
- Focuses accessibility added
- Version 6.8 deleted
#2
@
8 weeks ago
<!-- wp:list {"className":"cta"} --><ul class="cta wp-block-list" role="menu" aria-orientation="horizontal"> <!-- wp:list-item --><li role="menuitem"><a href="?page_id=2">First</a></li><!-- /wp:list-item --> <!-- wp:list-item --><li role="menuitem"><a href="?page_id=3">Second</a></li><!-- /wp:list-item --> </ul><!-- /wp:list -->
The block editor doesn't like that. But also, doesn't like the following, which has no way to ascribe role="menuitem"
<nav><ul class="cta wp-block-list" role="menu" aria-orientation="horizontal"> <!-- wp:navigation-link {"label":"First","url":"?page_id=2"} /--> <!-- wp:navigation-link {"label":"Second","url":"?page_id=3"} /--> </ul></nav>
#3
@
3 weeks ago
- Keywords close added
- Type changed from defect (bug) to enhancement
Hi
As mentioned, changes to blocks need to be proposed in the Gutenberg GitHub repository.
Blocks do not only use HTML. The block settings are also saved to the database. The settings must match the markup, otherwise there will be a block validation error.
Role is not supported on the list block. Requesting it would be an enhancement, not a bug.
You can read more about what attributes a block can support here: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/
You will need a custom solution, or, you can try the HTML block.
Please remember that the more details you can share about why you need a enhancement, the clearer the motivation is, the bigger the chance is that something gets implemented.
#4
@
10 days ago
You could ask for this on the Gutenberg repository, but I do not think the role="menu"
Menu Pattern is common enough to add support for it (either in existing blocks or by creating a new core block).
A separate concern is whether the KSES functions should allow aria-orientation
for users who do not have the unfiltered_html
capability. Within a Custom HTML block, the editor would retain the role
attribute on lists and list items for any user, but it could reject aria-orientation
for a user such as an Author.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
3 days ago
#6
@
3 days ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
In my opinion, aria-orientation
is very much a special case - it should probably only be inserted in scripting, since it's only application is to communicate how a user should navigate a component. That navigation will need to be controlled in external scripts, so the orientation characteristic should also be defined there.
If it's in the HTML directly, then if the scripting fails, the user will be informed that they are in a horizontal orientation context, then attempt to navigate using left/right arrow keys, but they will not work.
I would also avoid supporting role="menu"
for the list block; it's also a special case, and in my opinion should only be added via scripting. Like orientation, role="menu"
informs a user how they should interact with the element, and if you have the role without associated scripting to provide the needed interactions, then you're giving the user misinformation.
I agree with closing this issue. In both cases, these attributes should not be supported in the source HTML; they should only be added in script.
Reports about the block editor interface belong in the Gutenberg repository.
However, without knowing your links, I do not think the List block fits for the
role="menu"
Menu Pattern. Did you want to create a navigation menu (possibly with a Navigation block)?