-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Correctly recalculate column widths when the column count is increased by more than 2 at once #59301
Conversation
… increased by more than 2 at once
Size Change: +9 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7493f61. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8014892129
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done @t-hamano, this is testing well for me. Thanks for adding the test coverage, too! 🎉
@andrewserong Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An excellent work, @t-hamano 🎉
Fixes #58824
What?
This PR will correctly update the percentage width of each column to add up to 100% when two or more columns are added.
For example, if the widths of each of the four columns are
10%
,20%
,30%
, and40%
, and the number of columns is increased to 6, each column width will be:8.33%
,16.67%
,25%
,33.33%
,16.67%
,16.67%
( ❌ Total116.67%
)6.67%
,13.33%
,20%
,26.66%
,16.67%
,16.67%
( ✅ Total100%
)Why?
If all columns have percentage widths and a column is added, the width of the existing columns will be recalculated to account for the width of the newly added column. However, it appears that the current logic did not take into account the scenario where more than one column was added.
How?
I have taken into account the logic so that no matter how many newly added columns there are, the total value will always be 100%.
Additionally, since this scenario cannot be covered by unit tests, I added e2e tests.
Testing Instructions
Screenshots or screencast
825cf8e61553f1bd4c4dae1a0ecc294a.mp4