Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace outdated size controls in core blocks #52223

Closed
1 of 2 tasks
t-hamano opened this issue Jul 2, 2023 · 7 comments
Closed
1 of 2 tasks

Replace outdated size controls in core blocks #52223

t-hamano opened this issue Jul 2, 2023 · 7 comments
Labels
[Block] Latest Posts Affects the Latest Posts Block [Package] Block library /packages/block-library [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@t-hamano
Copy link
Contributor

t-hamano commented Jul 2, 2023

Description

ImageSizeControl (__experimentalImageSizeControl) was marked as deprecated in #51545.

However, there are two core blocks that use this component:

Just as this API in the image block was replaced by another API in #51545, I think it needs to be replaced by another API in these two blocks as well.

This issue has had its tasks/objectives updated. See this comment.

Step-by-step reproduction instructions

N/A

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

@mirka
Copy link
Member

mirka commented Aug 7, 2024

I've noticed that when you search for the string 25, 50, 75, 100, there are also two other blocks that implement a custom version of this outdated control:

Small width percentage picker

These should probably also be switched to DimensionTool, is that correct?

I'm going to go ahead and change the title of this issue so it reflects that __experimentalImageSizeControl is not currently deprecated anymore, and that there are other blocks to be switched over as well.

@mirka mirka changed the title Don't use deprecated __experimentalImageSizeControl in core blocks Replace outdated size controls in core blocks Aug 7, 2024
@t-hamano
Copy link
Contributor Author

t-hamano commented Aug 8, 2024

I'm going to go ahead and change the title of this issue so it reflects that __experimentalImageSizeControl is not currently deprecated anymore, and that there are other blocks to be switched over as well.

Yes, thanks for the update!

These should probably also be switched to DimensionTool, is that correct?

Since the only setting is the width, I don't think it needs to be switched to the DimensionsPanel. I think we can simply replace it with the recommended component.

Is the recommended component here the ToggleGroupControl? If so, I imagine it would look something like this:
button-width

I think the important bit is that we explicitly add an Auto ( or None) option so that we can reset the width.

@mirka
Copy link
Member

mirka commented Aug 12, 2024

I'm not against switching to ToggleGroupControl, since that's already better than what's in trunk. I was just thinking we might as well switch to a more standard UI pattern that also allows arbitrary values, for example as requested in #62247.

@t-hamano
Copy link
Contributor Author

Perhaps we need a component that consists of the ToggleGroupControl and other input field UIs, like the FontSizePicker component?

In addition to RangeControl and UnitControl, we may also be able to use SizeControl, as proposed in #62866.

The Search block has both a field for entering an arbitrary width and the ButtonGroup, so we may be able to try applying the new component to this block first:

image

By the way, a design update has been proposed for ToggleGroupControl: #64439

@mirka
Copy link
Member

mirka commented Sep 13, 2024

In #65339 we will be working on an incremental update to swap out all the ButtonGroups to ToggleGroupControls. That probably won't fully address this issue, but at least it will fix the outdated styling and accessibility issues.

@t-hamano
Copy link
Contributor Author

t-hamano commented Sep 14, 2024

Thanks for letting me know. Perhaps once #65346 and #65340 are merged, this issue can be closed?

@t-hamano
Copy link
Contributor Author

All ButtonGroup components in the core blocks have been replaced with ToggleGroupControl, so I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Latest Posts Affects the Latest Posts Block [Package] Block library /packages/block-library [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

5 participants