Improve the various Alignment controls props handling #63649
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block editor
/packages/block-editor
[Type] Bug
An existing feature does not function as intended
Description
Splitting this out from #63486 (comment)
Applies to:
These three components are very similar but they handle their props differently. which seems to introduce some confusion about how the label and description props are expected to be used. Also, these props aren't documented in the components readme and other props aren't documented as well.
AlignmentControl
It allows to pass both the
label
anddescribedBy
props, to change the default values.BlockAlignmentUI
Both the label and description are hardcoded. The values are
Align / Change alignment
, which seems redundant.Also, the label
Align
doesn't communicate what will be aligned. It's inconsistent with the AlignmentControl which does clarifyAlign text
. As such, it should beAlign block
.BlockVerticalAlignmentUI
Used for xample in the Media & Text block, where the label
Change vertical alignment
is hardcoded and there's no description. The label is inconsistent wihtAlign
andAlign text
. It should beAlign vertically
.Misleading descriptions
I'd think that if these controls would have clear and meaningful labels, they wouldn't need a visually hidden description in the first place. The lack of documentation and the fact the description is visually hidden leads to incorrect implementations. For example, in the Table block the alignment control passes a label prop with value
Change column alignment
. That makes sense. Unfortunately, thedescribedBy
is still the default one:Change text alignment
. Honestly, it's sad to see how the development process in this project often misses to check and test anything that is 'non visual'. The consequence is that the alignment button in the Table block has:Change column alignment
Change text alignment
Screen readers will announce both the label and description, thus providing a very confusing information to usdrs. Screenshots:
Step-by-step reproduction instructions
Align text
button in the block toolbar.aria-describedby
attribute that points to an element with the descriptionChange text alignment
. This description is a bit redundant.Change column alignment
button in the block toolbar.aria-describedby
attribute that points to an element with the descriptionChange text alignment
. This description is a misleading.Align
button in the block toolbar.aria-describedby
attribute that points to an element with the descriptionChange alignment
. Both the label and the description don't clarify what to align. The descriptionChange alignment
is redundant.Change vertical alignment
button in the block toolbar.aria-describedby
attribute.Change vertical alignment
is inconsistent with the other labels, to be more consistent it should say 'Align vertically'.Screenshots, screen recording, code snippet
AlignmentControl in a Paragraph:
AlignmentControl in a Table:
BlockAlignmentUI in a Group:
BlockVerticalAlignmentUI in a Media & Text:
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: