WordPress / gutenberg

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

BaseControl: Support accessible, flexible layouts #60836

Open mirka opened 5 months ago

mirka commented 5 months ago

What problem does this address?

We are running into issues where we want to tweak the layout of the help text, or reuse just the styles of the help text. Currently, it requires CSS overrides of BaseControl internals, or copy-pasting styles.

What is your proposed solution?

For example, export a BaseControl.VisualHelp like we do with BaseControl.VisualLabel. This must be accompanied by clear accessibility guidance in the docs. This is just a potential solution, there may be better solutions.

ciampo commented 1 month ago

https://github.com/WordPress/gutenberg/pull/61382#issuecomment-2240017470 is another example of the need for BaseControl to me more flexible.

Ideally, I'd love to reach a point where:

What do you think of those goals?

How can we balance short and long term goals?

ciampo commented 1 month ago

Couple more feedback items:

ciampo commented 1 month ago

Another note: if we plan for BaseControl's individual component to be used independently (like we do in a bunch of places for StyledLabel and StyledHelp), we should reduce any differences caused by rendering such components in isolation vs when they're rendered in BaseControl.

One example is how white space is not trimmed around StyledLabel (see https://github.com/WordPress/gutenberg/issues/63886#issuecomment-2247336435)