Skip to content

Conversation

@im3dabasia
Copy link
Contributor

What?

Closes #61410

In trunk, the selected units are undefined initially when the component is mounted. Due to this, when the slider is used, the values are updated without any unit. To solve this, a fallback value has been added in case the unit is undefined.

Why?

Solves a bug where the input slider of box control by default does not have any units attached to the number values.

How?

Added fallback logic to ensure units are always defined.

Testing Instructions

  1. Run npm run storybook:dev
  2. Checkout the BoxControl component
  3. Confirm that the slider has both value and unit when changed.

Screenshots or screencast

Before

Screen.Recording.2025-06-02.at.2.40.05.PM.mov

After

Screen.Recording.2025-06-02.at.2.40.05.PM.mov

@im3dabasia im3dabasia requested a review from ajitbohra as a code owner June 2, 2025 09:16
@github-actions
Copy link

github-actions bot commented Jun 2, 2025

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @giannis-koulouris-bb.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: giannis-koulouris-bb.

Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: Tropicalista <tropicalista@git.wordpress.org>
Co-authored-by: albanyacademy <brumack@git.wordpress.org>

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Jun 3, 2025
@im3dabasia im3dabasia force-pushed the fix/box-control-fallback-units branch from 1a8b3b2 to b7170ce Compare June 3, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Box Control range slider doesn't set a unit initially

2 participants