WordPress / gutenberg

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

Make the X Close buttons target size larger #66277

Open afercia opened 5 days ago

afercia commented 5 days ago

Description

See conversation on https://github.com/WordPress/gutenberg/pull/63243

Recent changes in https://github.com/WordPress/gutenberg/pull/61331 and other PRs standardized the size of various X Close buttons to the small variant, which is 24 by 24 pixels.

While standardizing is good, unnecessarily reducing the target size isn't.

Whenever possible, given the constraints ofd the layout and containers where the buttons live, the target size should be as large as possible.

Additionally, the 24px size is inconsistent with other buttons that may be displayed close to the X button. A few examples where I used background colors to illustrate the inconsistency:

In the Styles panel header: 3 buttons use the compact size (32 pixels) and the X button uses the small size (24 pixels):

Image

Similarly, in the PLugins panel, one button is compact and the X button is small:

Image

A good point was made on https://github.com/WordPress/gutenberg/pull/63243#issuecomment-2422641020 that these buttons should be horizontally aligned with other controls in the UI so that the right padding of the containers should be adjusted. In the screenshot below, observe that besides the inconsistent size, the container right padding is inconsistent as well:

Image

Additionally: all the other X close buttons e.g. within modal dialogs should be at least compact (32 by 32 pixels).

It is worth reminding that the WCAG Target Size (Minimum) requires a size of at least 24 by 24 CSS pixels. That's the minimum though. There's no reason not to make these buttons bigger, when possible. The editor should aim to provide the best possible experience and not be limited to meet the minimum requirements.

Step-by-step reproduction instructions

Screenshots, screen recording, code snippet

No response

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.

afercia commented 5 days ago

Quickly looking at a few buttons instances in the codenase, it appears there's some room for some CSS clean-up. For example, the X close button of the tabs panel uses the small variant. That should be sufficient to render the button with the 24 pixels size but there's still some CSS overriding in place, which I assume it's a leftover and should be removed. See below, where the $icon-size variable is 24 pixels:

https://github.com/WordPress/gutenberg/blob/75e336606c8edcc8e557760b8407935c59eb4d44/packages/editor/src/components/sidebar/style.scss#L1-L8

Image

t-hamano commented 4 days ago

This close button appears to have been changed to a small size by #61331.

https://github.com/WordPress/gutenberg/pull/61331/files#diff-c2b4b3fd0242f8ea3fab899322d819626b990004cfa592f949967217bed13e71R305

cc @WordPress/gutenberg-design

jameskoster commented 4 days ago

I agree the buttons should be the same size, as should the spacing between them and the horizontal padding of their containers. This consistency would make alignment much simpler to achieve and in most cases the default meaning we can remove some ad hoc styling.