Columns Block: Account for the margin between columns when setting custom widths inline #17583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the inline column widths to subtract the 16px used for margins from the flex basis (changing them from
flex-basis: ##%
toflex-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):
After:
Tablet width: (less than 767px wide but more than 600px wide):
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: