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

Columns Block: Account for the margin between columns when setting custom widths inline #17583

Conversation

laurelfulford
Copy link
Contributor

@laurelfulford laurelfulford commented Sep 25, 2019

Description

This PR updates the inline column widths to subtract the 16px used for margins from the flex basis (changing them from flex-basis: ##% to flex-basis: calc( ##% - 16px. ). This makes sure the columns don't wrap prematurely on tablet-sized screens.

How has this been tested?

I've tested in Firefox (69.0.1), Chrome (77.0.3865.90), Safari (13.0.1) and IE Edge (18), moving between different screen sizes -- confirming that the display of the block outside of the affected breakpoint doesn't change.

Screenshots

The below screenshots use a two column block, with widths set to 66.66% and 33.33%, and the testing site uses Twenty Nineteen, but I've been able to recreate the issue with other themes:

Before:

Tablet width: (less than 767px wide but more than 600px wide):

image

After:

Tablet width: (less than 767px wide but more than 600px wide):

image

Types of changes

Breaking fix -- as is right now, this PR will cause existing columns block to throw an error in the editor ("This block contains unexpected or invalid content."). The blocks need to be recreated from scratch after the PR is applied.

Fixes: #17340

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@draganescu
Copy link
Contributor

@laurelfulford can't the existing blocks be handled by deprecated API?

@earnjam
Copy link
Contributor

earnjam commented May 13, 2020

This looks like it was resolved with #20597, so I'm going to close it out. If it's still an issue, we can reopen.

@earnjam earnjam closed this May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Columns Block: Custom column widths can wrap prematurely
3 participants