Block API: Improve ariaLabel
block support
#68764
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Type] Enhancement
A suggestion for improvement.
Issues and PRs related to this discussion:
ariaLabel
block support to the Tag Cloud block)What problem does this address?
Adding
ariaLabel
block support to a block makes it possible to set thearia-label
attribute internally - it does not expose a UI for setting this attribute.This attribute can be injected into a block HTML or theme template like this:
The schema for this support references the aria-label attribute on HTML elements, but dynamic blocks do not save HTML to the database, so when you edit and save the content or template, the
aria-label
value is lost because it cannot be referenced.Especially for the Navigation block, i.e. nav element, the loss of
aria-label
attribute values is a big problem. We need to find a way to solve this problem.What is your proposed solution?
The three approaches I can think of are:
1. Add ariaLabel "attribute" in addition to block support
The
ariaLabel
block support respects existing attribute definitions. By explicitly defining the ariaLabel attribute in a dynamic block, the value will not be lost as it will be preserved as part of the comment delimiter (Related discussion).2. Extend block support
Currently, the value type of this block support is a boolean value. We may be able to extend this to allow us to decide how we want to reference the value. Something like this:
This approach was also attempted with anchor support (You can see the series of efforts at #51402.).
3. Change the block support schema
We could also change the block support schema itself, which means we always store values as part of the comment delimiter, rather than referencing the stored content.
This approach might require us to add a block deprecation to blocks that already have this block support, and it might affect developers who already use this block support.
In the past we've run into issues with broken blocks when changing the schema for anchor support. See #48232 for more details.
Other suggestions
Although not directly related to this support failure, it's also worth discussing whether we should expose a UI for editing the
aria-label
attribute by default.cc @Mamaduka @fabiankaegy @afercia @carolinan @aaronrobertshaw @talldan
The text was updated successfully, but these errors were encountered: