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

Saving a spacer block without a height value causes a block validation error #68817

Open
3 of 6 tasks
carolinan opened this issue Jan 22, 2025 · 8 comments · May be fixed by #68819
Open
3 of 6 tasks

Saving a spacer block without a height value causes a block validation error #68817

carolinan opened this issue Jan 22, 2025 · 8 comments · May be fixed by #68819
Labels
[Block] Spacer Affects the Spacer Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

Description

If you delete the value of the height option and save, and then refresh the page (or leave and return to edit the content later), there is a block validation error.

I only tested this with block themes that have a theme.json. I tested with the default spacing presets and with custom presets.

When there is a custom spacing preset that uses clamp, like in Twenty Twenty-Five, there is one more issue.
If you select a spacing preset, then toggle the "use size preset" button so that the size input and unit input options show again, and then change the unit but not the size, then the size is also missing and the same block validation error shows.

Step-by-step reproduction instructions

Insert a spacer block.
Delete the value of the height option and save, and then refresh the page.

Screenshots, screen recording, code snippet

A spacer block without a height, with a block validation error showing.

Environment info

WordPress 6.7.1 with and without Gutenberg trunk.

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@carolinan carolinan added [Block] Spacer Affects the Spacer Block [Type] Bug An existing feature does not function as intended labels Jan 22, 2025
@himanshupathak95
Copy link
Contributor

Hey @carolinan, I could see the same behavior after following the steps mentioned -

Screen.Recording.2025-01-22.at.09.57.25.mov

I am looking further for the cause and possible fix.

@carolinan
Copy link
Contributor Author

Hi @himanshupathak95 May I suggest that additional testing is mainly needed for issues that has the label "needs testing".

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 22, 2025
@Mamaduka
Copy link
Member

I'm seeing at least three recent PRs fixing Spacer block controls, but are linked to different issues. I wonder if they're related.

@Mayank-Tripathi32
Copy link
Contributor

I'm seeing at least three recent PRs fixing Spacer block controls, but are linked to different issues. I wonder if they're related.

#68819
#68818
#68815

All 3 may look the same but are addressing different problems related to spacer blocks.

@carolinan
Copy link
Contributor Author

Note: I did not test the width. I forgot that setting even existed.

@yogeshbhutkar
Copy link
Contributor

yogeshbhutkar commented Jan 22, 2025

Note: I did not test the width. I forgot that setting even existed.

There wouldn't be any block validation error when setting up the width as there's no default value provided in the block.json for width, so it's unlikely that this value will be overridden to the default value to cause the validation error. (Ref. Context)

However, I've noticed two minor bugs (maybe out of the scope of this issue) with the way the width control works within spacer:
I. The control accepts negative values: Although, there are other controls, like the font-size control that also accept these negative values, in the width control one can use cmd + mouse wheel or cmd + arrow key to sort of scroll up to the negative values. In other controls (font size), it stops at zero and doesn't go below that. Also, the negative values are automatically set to 0 on save in the other controls, however, that's not the case with the width control.

Screen.Recording.2025-01-22.at.5.49.28.PM.mov

ii. The 0 always stays and is not clearable (not the case with other controls).
For example, if I want the width to be 50px, then I'd need to write 50 after 0 and then use the arrow keys to navigate back to 0 and then remove it just because it's not clearable. This sounds like a small bug, but it might confuse the users.

Screen.Recording.2025-01-22.at.5.57.56.PM.mov

I believe it's best to create a combined separate issue for the width control.

@carolinan
Copy link
Contributor Author

Thank you for checking.

@stokesman
Copy link
Contributor

ii. The 0 always stays and is not clearable (not the case with other controls).

That was #51616 and closed by #68815.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Spacer Affects the Spacer Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants