Button: the small and compact sizes should not use a fixed width #63247
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Components
/packages/components
[Type] Bug
An existing feature does not function as intended
Description
Splitting this out from #61761 (comment)
The
compact
andsmall
sizes of the Button component use a fixedwidth
. See the related CSS:gutenberg/packages/components/src/button/style.scss
Lines 276 to 297 in 6c434b0
The fixed width is only applied when the buttons use an icon and don't contain text.
However, the current implementation of 'Show button text labels' preference in the editor doesn't use text. It uses CSS generated content. By setting a fixed width, these sizes aren't compatible with 'Show button text labels' as the CSS generatd text will overlap the surrounding content.
I'm not sure why a fixed width is necessary in the first place. Unless I'm missing something, when the Button contains an icon and don't contain text, a
min-width
woul dbe sufficient as the icon will not be greater than the button.It appears the first fixed width was added long time ago for the
small
size in #19344I'd tend to think all fixed widths should be removed, they seem unnecessary to me.
Step-by-step reproduction instructions
children
string"Code is poetry"
and only keep two double quotes.Emulating what would happen with the editor 'Show button text labels' preference enabled:
More screenshots at #61761
Screenshots, screen recording, code snippet
No response
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
The text was updated successfully, but these errors were encountered: