You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The current schema references the aria-label attribute if it exists in the HTML markup. This works fine for the Group block, whose HTML markup is preserved, but the value cannot be referenced in the Navigation block, whose HTML markup is not preserved.
As a result, as reported in #68719, when you update a template that contains a Navigation block with the aria-label attribute, the aria-label value disappears.
In Twenty Twenty-Five and Twenty Twenty-Four, aria-label is applied to some Navigation blocks. I believe that the disappearance of this value is a issue from an accessibility perspective.
How?
Remove the source, attribute, and selector fields from the schema definition. This will break Group blocks that already support ariaLabel, so something needs to be done about it.
I noticed that there is already a fix for block validation regarding custom class names (fixCustomClassname() function). I used this process to automatically migrate the attributes via the fixAriaLabel() function so that block validation does not fail.
To solve this problem, I considered three approaches (See #68764). I believe this approach is the best.
Save the post and refresh your browser. The block should not break.
Navigation Block
Activate the Twenty Twenty-Five theme.
After resetting the Footer template part, open the editor canvas. This template part contains Navigation blocks with aria-labels About, Privacy, and Social.
Make changes to this template part and save it.
Open the code editor. The three aria-label values should not have disappeared.
Open the site. The three aria-label values should not have disappeared.
Flaky tests detected in a71ec20.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.
If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
[Feature] Block APIAPI that allows to express the block paradigm.[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] BugAn existing feature does not function as intended
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68764
Alternatives to #68735
What?
This PR changes the schema for the
ariaLabel
block support to save its value in the comment delimiter.That is, the block HTML will be updated to look like this:
Why?
The current schema references the
aria-label
attribute if it exists in the HTML markup. This works fine for the Group block, whose HTML markup is preserved, but the value cannot be referenced in the Navigation block, whose HTML markup is not preserved.As a result, as reported in #68719, when you update a template that contains a Navigation block with the
aria-label
attribute,the aria-label
value disappears.In Twenty Twenty-Five and Twenty Twenty-Four,
aria-label
is applied to some Navigation blocks. I believe that the disappearance of this value is a issue from an accessibility perspective.How?
Remove the
source
,attribute
, andselector
fields from the schema definition. This will break Group blocks that already supportariaLabel
, so something needs to be done about it.I noticed that there is already a fix for block validation regarding custom class names (
fixCustomClassname()
function). I used this process to automatically migrate the attributes via thefixAriaLabel()
function so that block validation does not fail.To solve this problem, I considered three approaches (See #68764). I believe this approach is the best.
Testing Instructions
Group Block
Navigation Block
About
,Privacy
, andSocial
.aria-labe
l values should not have disappeared.aria-label
values should not have disappeared.