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

BoxControl: Better minimum value support #67819

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

youknowriad
Copy link
Contributor

Related #67625

What?

In some BoxControl components, (like for margin) we want to allow negative margins. This is done by passing min: -Infinity to the component. This is already partially supported and used but I've found that the "RangeControl" doesn't work in an optimal way: You can actually set any number in the Range control even if it's inferior to min

This is a tiny PR that just passes the minimum number down to the RangeControl when it's provided and different than an infinite value. It's not perfect but it's slightly better than what's in trunk.

Testing Instructions

  • Run storybook locally npm run storybook:dev
  • Define inputProps as something like { min: 10 } for the default BoxControl component story.
  • Notice that the minimum is respected in both ways of changing the value.

@youknowriad youknowriad added [Type] Bug An existing feature does not function as intended [Feature] UI Components Impacts or related to the UI component system labels Dec 11, 2024
@youknowriad youknowriad self-assigned this Dec 11, 2024
Copy link

github-actions bot commented Dec 11, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to me, the change makes sense 👍

@youknowriad youknowriad force-pushed the update/box-control-better-min-support branch from 52fcd67 to 2973557 Compare December 12, 2024 10:21
@youknowriad youknowriad enabled auto-merge (squash) December 12, 2024 10:21
Copy link

Flaky tests detected in 2973557.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12294380995
📝 Reported issues:

@youknowriad youknowriad merged commit 9e3bdeb into trunk Dec 12, 2024
63 checks passed
@youknowriad youknowriad deleted the update/box-control-better-min-support branch December 12, 2024 10:57
@github-actions github-actions bot added this to the Gutenberg 20.0 milestone Dec 12, 2024
yogeshbhutkar pushed a commit to yogeshbhutkar/gutenberg that referenced this pull request Dec 18, 2024
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants