WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

The HeightControl is unlabeled #57681

Closed afercia closed 10 months ago

afercia commented 10 months ago

Description

Yet another case of unlabeled controls. Cc @ciampo

Discovered while working on https://github.com/WordPress/gutenberg/pull/57680

The HeightControl uses two components under the hood:

They are both totally unlabeled, as HeightControl dosn't pass any label to them The components themselves are open to misues, as omitting the label prop doesn't throw any error / warning / deprecation.

Unlabeled controls are not acceptable after almost 7 years of life of this project. This is basic accessibility and I would say basic HTML.

Step-by-step reproduction instructions

Screenshots, screen recording, code snippet

Screenshot 2024-01-09 at 15 40 29

Current state on trunk, notice the lack of a label prop or aria-label attribute:

UnitControl in the HeightControl:

https://github.com/WordPress/gutenberg/blob/169e2e5bc3410eee23b19d6ac788e3ea111a88f4/packages/block-editor/src/components/height-control/index.js#L153-L160

RangeControl in the HeightControl:

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/height-control/index.js/#L164-L178

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

afercia commented 10 months ago

While the fix is trivial, this bug proves yet one more time that:

Besides making Gutenberg not accessible, I would like to remind the editor packages are public and used also outside of the Gutenberg project (at least potentially). As such, releasing components that are open to misuse doesn't contribute to make the Web a better place. Rather, it makes it worse.

Cc @joedolson @alexstine @andrewhayward

alexstine commented 10 months ago

CC: @annezazu . I think we're reaching a point with this where it needs to have a wider discussion with leadership. I don't wish to offend anyone in the project but Andrea is right. These components can be used outside of the editor and there should be no way to exclude a label for accessibility. It could be a hidden aria-label but some type of label.

afercia commented 10 months ago

I'd like to add that it's pretty saddening and not motivating at all that this bug is in the codebase since more than one year and no one noticed it so far. There's no automated tests in place, no accessibility checks (aXe) in place other than in the Storybook and evidently not manual testing during implementation and review.

Once again, this is not complex. It's basic HTML. And we're failing at it.

Honestly, I think we're at a point where either this project needs to make sure this kind of bugs will not happen again or, not my intent to offend anyone, this project needs to consider to restrict merge permission only to contributors who can assure some higher code quality.

ciampo commented 10 months ago

Hey folks, thank you for your continued effort in flagging all these accessibility violations.

As there already is an open issue (#51740) where the general topic is being actively discussed, we should probably continue the conversation there to avoid repetition and keep the focus.

I would also kindly ask you not to be pinged on every single labelling-related issue, as I'm definitely not in charge of single-handedly maintaining this part of the codebase (and we already have a separate issue).

ramonjd commented 10 months ago

The fix seemed pretty straight forward. I've thrown up a PR here:

Apologies, I didn't see the PR linked above 🤦🏻

I've closed my PR

andrewserong commented 10 months ago

Thanks for the discussion here, folks, I think this one might have been my oversight when originally introducing the component to pair a UnitControl with a RangeControl for the minimum height controls. Previous to https://github.com/WordPress/gutenberg/issues/45875 we were using a single UnitControl for the minimum height controls with a label passed to it, and then in #45875 the label was moved "up" to a legend within a wrapping fieldset for these two controls. However that change failed to pass a label down to the individual UnitControl and RangeControl components within it.

Good to know that it was missed and that in that scenario we still need to have labels on each individual controls within that fieldset, even if the labels aren't visible.

In this case, what is the desired label for each component? We have a legend at the wrapper level (e.g. Minimum Height). Would we re-use that same label for the UnitControl and RangeControl (as they're both changing the same value), or would a more specific label for each of those controls be preferred?

andrewserong commented 10 months ago

Edit: oh, I see there's a fix open already in: https://github.com/WordPress/gutenberg/pull/57683 that passes down the label. I'll give that a review. Thanks @afercia!

I'll be sure to keep an eye out for similar issues in other refactors and reviews.

noisysocks commented 10 months ago
  • Contributors and reviewers in this project are not trained / educated / do not have enough knowledge to understand and provide appropriate labeling for interactive controls.

An accessibility bug doesn't mean that contributors lack accessibility training. That would be like saying a logic error means that contributors can't program or a typo means that contributors can't spell. It's a mistake, they're inevitable, please be kind and assume positive intent.

alexstine commented 10 months ago

@noisysocks I agree sometimes delivery isn't great and it should have been phrased better but it's also like saying let's remove PHPUnit and lint checks from Core and good luck. As long as Gutenberg has been around, there should be more solid tests around accessibility and we should be designing in such a way that devs get big nasty warnings when something might be inaccessible so that way mistakes are less likely to happen. I agree, I don't think the blame helps much here but it would be nice to start seeing some things evolve in the right direction. We're all people, we're all going to make mistakes. Let's figure out how to implement technology/automation in such a way that mistakes are less likely to happen.

If you look back in some previous PRs, even I have made things worse from time to time or broken Voiceover when it worked on Windows.

Thanks.

noisysocks commented 10 months ago

Yep absolutely. Automated testing for common a11y errors sounds like it would be valuable. Is it something you're interested in exploring?

alexstine commented 10 months ago

@noisysocks It has been attempted before but never really made it completely. I don't have a lot of JavaScript experience as front-end development isn't my day job so I wouldn't really know how to drive a goal like that.