Skip to content

Conversation

@SirLouen
Copy link
Member

@SirLouen SirLouen commented Nov 15, 2025

What?

Closes #73291

If we remove the value of a Border Radius (in a paragraph or a group or anywhere where we have this control), the unit flips to px instead of retaining the selected value rem or whatever.

How?

We forgot to add the flat (single value), unit to the onChangeUnit in the input control when corner equals all. At first I thought there could be a difference between corner to all and the multiple options alternative, but I think that I any case the newUnits should be set for the corner that is being switched (including the all option). So there is no point on differentiating them.

This was introduced in #67544 but I can't really see in the PR why this differentiation was necessary, so I assume it's a little bug.

Testing Instructions

  1. Add a group block
  2. Go to the styles and select rem for the units in the Border radius
  3. Add any value, 1 for example
  4. Remove the value. The unit should not flip to px

Additional Testing ideas

  1. Play around with other Border radius units. Not only the "all" but the individual radius (topLeft, bottomLeft, etc...)

Testing Instructions for Keyboard

  1. Remove the value with the backspace; the unit should not flip to px

Screenshots or screencast

Before After
image image

@SirLouen SirLouen requested a review from ellatrix as a code owner November 15, 2025 16:48
@github-actions
Copy link

github-actions bot commented Nov 15, 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.

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: SirLouen <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: sato-jp <[email protected]>

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

@SirLouen SirLouen added the [Type] Bug An existing feature does not function as intended label Nov 15, 2025
@SirLouen SirLouen requested review from youknowriad and removed request for ellatrix November 15, 2025 16:49
@SirLouen SirLouen changed the title Components: Border Rradius Control: Empty Values triggers unintended px unit conversion Block Editor: Border Radius Control: Empty Values triggers unintended px unit conversion Nov 15, 2025
@t-hamano t-hamano added [Package] Block editor /packages/block-editor Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 17, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.9 Editor Tasks Nov 17, 2025
@t-hamano
Copy link
Contributor

This problem appears to be caused by #67544 and was first observed in WordPress 6.9. Let's fix this in RC2 if possible.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Great catch, this looks really close to me! I think we might need to retain the if block, but just move setting newUnits[ corner ] = next out from the else block. I've added a comment, but the existing behaviour otherwise offers a fallback when toggling units with empty values.

Otherwise once that's fixed up, I think this will be good to get in!

Comment on lines 76 to 81
if ( corner === 'all' ) {
newUnits.topLeft = next;
newUnits.topRight = next;
newUnits.bottomLeft = next;
newUnits.bottomRight = next;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might still want to retain this if block, but just move newUnits[ corner ] = next; out from the else. Otherwise, what's happening in this PR is that if I don't have a value set, and I change the unit, then when I expand the controls, they revert to px instead of inheriting from the parent / all control:

2025-11-17.17.18.37.mp4

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we could leave the conditional statement unchanged and just explicitly update the flat property?

const onChangeUnit = ( next ) => {
	const newUnits = { ...selectedUnits };
	if ( corner === 'all' ) {
		newUnits.flat = next;
		newUnits.topLeft = next;
		newUnits.topRight = next;
		newUnits.bottomLeft = next;
		newUnits.bottomRight = next;
	} else {
		newUnits[ corner ] = next;
	}
	setSelectedUnits( newUnits );
};
4e508ed0b55443325f10cb6334b2932c.mp4

@SirLouen
Copy link
Member Author

Great catch, this looks really close to me! I think we might need to retain the if block, but just move setting newUnits[ corner ] = next out from the else block. I've added a comment, but the existing behaviour otherwise offers a fallback when toggling units with empty values.

Otherwise once that's fixed up, I think this will be good to get in!

@andrewserong, good point. I firstly committed with the simpler fix but then I started looking into it, and testing a bit, trying to understand the meaning behind that conditional, and I ended with the conclusion it was not doing anything in particular. I looked into the previous PR, but I could not find a reason at first glance. Now I see that in the all condition, its setting what you see and what you don't see, not intuitive but great ux.

I have reset to my previous commit, preserving that conditional.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

This approach seems best to me, but I'd appreciate second feedback since I wasn't directly involved with #67544 and we're in the RC phase now 🙏

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-up @SirLouen, this is testing nicely for me now, too! 🚀

I'll merge this in now.

@andrewserong andrewserong merged commit 86052a8 into WordPress:trunk Nov 17, 2025
37 checks passed
@github-project-automation github-project-automation bot moved this from 🔎 Needs Review to ✅ Done in WordPress 6.9 Editor Tasks Nov 17, 2025
@github-actions github-actions bot added this to the Gutenberg 22.2 milestone Nov 17, 2025
@github-actions github-actions bot removed the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Nov 17, 2025
gutenbergplugin pushed a commit that referenced this pull request Nov 17, 2025
Co-authored-by: SirLouen <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: sato-jp <[email protected]>
@github-actions
Copy link

I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: 68b2fa4

@github-actions github-actions bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Nov 17, 2025
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Nov 18, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

- [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055)
- [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585)
- [Notes: Collapse note on blur](WordPress/gutenberg#73158)
- [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324)
- [Fix navigation tag entity binding](WordPress/gutenberg#73255)
- [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345)
- [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327)
- [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325)
- [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173)
- [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241)
- [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177)
- [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238)
- [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189)
- [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164)

Developed in #10528.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Fixes #64267.
Props priethor.

git-svn-id: https://develop.svn.wordpress.org/trunk@61262 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Nov 18, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

- [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055)
- [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585)
- [Notes: Collapse note on blur](WordPress/gutenberg#73158)
- [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324)
- [Fix navigation tag entity binding](WordPress/gutenberg#73255)
- [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345)
- [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327)
- [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325)
- [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173)
- [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241)
- [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177)
- [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238)
- [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189)
- [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164)

Developed in WordPress/wordpress-develop#10528.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Fixes #64267.
Props priethor.
Built from https://develop.svn.wordpress.org/trunk@61262


git-svn-id: http://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Nov 18, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

- [Block Bindings: Add unit test coverage for `core/post-data` source](WordPress/gutenberg#73055)
- [Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585)
- [Notes: Collapse note on blur](WordPress/gutenberg#73158)
- [Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324)
- [Fix navigation tag entity binding](WordPress/gutenberg#73255)
- [DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345)
- [Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327)
- [Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325)
- [Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173)
- [Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241)
- [Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177)
- [Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238)
- [Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189)
- [Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164)

Developed in WordPress/wordpress-develop#10528.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Fixes #64267.
Props priethor.
Built from https://develop.svn.wordpress.org/trunk@61262


git-svn-id: https://core.svn.wordpress.org/trunk@60574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Nov 18, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

[Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055)
[Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585)
[Notes: Collapse note on blur](WordPress/gutenberg#73158)
[Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324)
[Fix navigation tag entity binding](WordPress/gutenberg#73255)
[DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345)
[Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327)
[Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325)
[Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173)
[Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241)
[Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177)
[Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238)
[Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189)
[Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164)
Developed in #10528.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Reviewed by davidbaumwald.
Merges [61262] to the 6.9 branch.

Props priethor, ellatrix.
See #64267.

git-svn-id: https://develop.svn.wordpress.org/branches/6.9@61263 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Nov 18, 2025
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/.

[Block Bindings: Add unit test coverage for core/post-data source](WordPress/gutenberg#73055)
[Block Bindings: Error handling for external sources.](WordPress/gutenberg#72585)
[Notes: Collapse note on blur](WordPress/gutenberg#73158)
[Border-radius values triggers unintended px conversion](WordPress/gutenberg#73324)
[Fix navigation tag entity binding](WordPress/gutenberg#73255)
[DataViews: ensure primary actions are not wrapped in the list layout](WordPress/gutenberg#73345)
[Fix: Fit Text may overflow into the padding area.](WordPress/gutenberg#73327)
[Merge "Icon Size" and "Icon size" translation strings](WordPress/gutenberg#73325)
[Notes: Improve delete confirm message for replies](WordPress/gutenberg#73173)
[Fix: Custom font size taking over fit text.](WordPress/gutenberg#73241)
[Fix a11y of descriptions and alerts for "Invalid" Nav Items](WordPress/gutenberg#73177)
[Stretchy text: Hide variations in Block Inspector (hack)](WordPress/gutenberg#73238)
[Update button label from "Add new note" to "Add new reply"](WordPress/gutenberg#73189)
[Notes: Fix first note creation with pinned sidebar](WordPress/gutenberg#73164)
Developed in WordPress/wordpress-develop#10528.
See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches.

Reviewed by davidbaumwald.
Merges [61262] to the 6.9 branch.

Props priethor, ellatrix.
See #64267.
Built from https://develop.svn.wordpress.org/branches/6.9@61263


git-svn-id: http://core.svn.wordpress.org/branches/6.9@60575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Projects

Development

Successfully merging this pull request may close these issues.

Editing rem border-radius values triggers unintended px conversion, preventing 0.5rem input

3 participants