Block Library: Flatten width calculation of gallery columns #20690
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.

Fixes #20652
This pull request seeks to update the width calculation applied to the gallery block columns. These changes are intended both as a simplification/unification of the width calculation, and as a resolution to a crash which occurs in Microsoft Edge.
As observed at #20652 (comment), the crash appears to occur as a result of the Edge-specific
@supports (-ms-ime-align:auto) {block implemented in the gallery block styles.As noted in #13326, the original issue #13270 is a result of how Edge interprets the
widthstyle. Compare how the stylewidth: calc((100% - 16px * 2) / 3);is interpreted between Edge and Chrome:The proposed changes should apply effectively the same width, but simplify the calculation at compile time, resulting in the style
calc(33.33333% - 10.66667px). It appears that this is handled better in Edge, avoiding the early wrapping, rounding down to10.66pxper column.Aside: There is overflow which occurs in Edge for the gallery block, with or without these changes. This should probably be investigated separately.
Testing Instructions:
Repeat steps to reproduce from #20652, verifying that no crash occurs.
Repeat steps to reproduce from #13270 / testing instructions from #13326, verifying that gallery columns wrap as expected both in Edge and in your preferred browser.
Follow-up tasks:
There is another style which uses the problematic
@supports(-ms-ime-align:auto)block:gutenberg/packages/components/src/modal/style.scss
Lines 80 to 86 in 3ab3727
However, there is no immediate crash which occurs as a result of this style. The problem may only manifest as a combination of
@supportswithin a@mediamedia query. In any case, over time we should consider removing these Edge-specific styles, which are no longer valid in recent Chromium-based versions of Edge.