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

Layout (padding): invalid CSS when "Link Sides" inactive and fields left empty #33318

Closed
chthonic-ds opened this issue Jul 9, 2021 · 4 comments · Fixed by #33444
Closed

Layout (padding): invalid CSS when "Link Sides" inactive and fields left empty #33318

chthonic-ds opened this issue Jul 9, 2021 · 4 comments · Fixed by #33444
Assignees
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@chthonic-ds
Copy link
Contributor

chthonic-ds commented Jul 9, 2021

Description

The Layout panel includes support for user-defined padding. Users can choose to enter a single value for all sides of a block or unique values per side. This choice is offered via a Link Sides toggle button.

When Link Sides is inactive and values are not entered for one or more sides, a property without a value is sometimes included in the inline style. When this happens the result looks like this:

element.style {
    padding-top: 2rem;
    padding-right: rem;
    padding-bottom: 2rem;
    padding-left: rem;
}

Step-by-step reproduction instructions

  1. Add a Group block.
  2. Block settings > Layout > Spacing > Padding: enter a value. Note the default unit is px.
  3. Save and check the front-end to see padding properties are correctly set for each side.
  4. Return to the editor and click reset to clear the Padding field.
  5. Change the unit to rem (this issue sometimes occurs without doing this but this step seems to ensure a consistent error).
  6. Set the "Link Sides" toggle to inactive to reveal fields for each side.
  7. Enter a value for the top and bottom of the element (first and third fields).
  8. Save and check the front-end to see padding properties are incorrectly set for all sides. For a side where no value has been entered, the corresponding property has a blank value.

Expected behaviour

If a field is left empty the corresponding property should be omitted from the inline style.

Actual behaviour

The current output is invalid CSS: a property is declared without a value.

Screenshots or screen recording (optional)

padding-invalid-css-when-per-side-fields-empty-090721-001

WordPress information

  • WordPress version: 5.8-RC2
  • Gutenberg version: 11.0.0
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1 Blocks

Device information

  • Device: Desktop
  • Operating system: Windows 10
  • Browser: Chrome 91.0.4472.124
@vaish567
Copy link

vaish567 commented Jul 9, 2021

Howdy! @chthonic-ds Could you assign me to complete this bug! I would like to contribute :)

@chthonic-ds
Copy link
Contributor Author

@vaish567 sorry, I have nothing to do with this project.

@paaljoachim paaljoachim added [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Bug An existing feature does not function as intended labels Jul 12, 2021
@paaljoachim
Copy link
Contributor

paaljoachim commented Jul 12, 2021

Hi @vaish567

I went ahead and assigned this issue to you.
Thanks for wanting to work on it!

I will also let @aaronrobertshaw know about this issue.

@aaronrobertshaw
Copy link
Contributor

A PR addressing this issue has been created and should not be too far off landing. #33444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [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.

4 participants