Columns: Width recalculation does not work correctly when number of columns is increased by more than 2 at once #58824
Labels
[Block] Columns
Affects the Columns Block
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
When the number of columns is changed in a Columns block, if the columns all have percentage widths, the sum of the widths of each column is recalculated to be exactly 100%. However, when the number of columns is increased by 2 or more, it doesn't seem to be completely 100%.
So it looks like the current logic only takes into account the case where the number of columns increases by 1.
For example, assume that each of the four columns has the following widths:
| 20% | 30% | 30% | 20% |
✅ Correct: When the number of columns increases from 4 to 5
| 16% | 24% | 24% | 16% | 20% |
Total: 100%
✅ Correct: When the number of columns is reduced from 4 to 3
| 25% | 37.5% | 37.5% |
Total: 100%
✅ Correct: When the number of columns is reduced from 4 to 2
| 40% | 60% |
Total: 100%
❌ Wrong: When the number of columns increases from 4 to 6
| 16.67% | 25% | 25% | 16.67% | 16.67% | 16.67% |
Total: 116.68%
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
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
The text was updated successfully, but these errors were encountered: