Skip to content

Keep grid columns on WordPress 7.2 - #286

Draft
amjadr360 wants to merge 1 commit into
mainfrom
fix/2690-wp72-grid-block-gap
Draft

amjadr360 wants to merge 1 commit into
mainfrom
fix/2690-wp72-grid-block-gap

Conversation

@amjadr360

Copy link
Copy Markdown
Contributor

WordPress 7.2 knocks a column off some grids on desktop. A row of three pricing cards becomes two, with the third card alone on a new row, and a two-up stats grid stacks into one column. The cause is a new check in 7.2 that rejects the formula our theme uses for the default space between blocks. When the check fails, WordPress works out column widths with a much smaller gap than the one it actually draws, so the last column no longer fits.

This moves the same formula into a custom property and points the block gap at it. That form passes the new check, and the gap stays exactly the same size. On 7.2 the grids now look identical to 7.1, and 7.1 doesn't change.

  • Only grids that set both a column count and a minimum column width were affected, from 1024px wide up. Phones and tablets were fine.
  • No style variation uses a formula for its own gap. They all use spacing presets, which pass the check.

Screenshots

1. Pricing cards on WordPress 7.2, before
pricing before wp72

2. Pricing cards on WordPress 7.2, with this fix (same as 7.1)
pricing after fix

3. Stats grid on WordPress 7.2, before
stats before wp72

4. Stats grid on WordPress 7.2, with this fix (same as 7.1)
stats after fix

WordPress 7.2 checks the global blockGap with wp_sanitize_block_gap_value()
before using it to size responsive grid columns. The check rejects any
value containing "(" unless it is a single var(--name). Our fluid
max(calc(clamp())) gap failed it, so core sized grid columns against a
0.5em fallback while the gap it draws stayed about 32px. Grids that set
both a column count and a minimum column width then lost a column from
1024px up: three pricing cards became two plus one, two stats became one.

The same formula now lives in settings.custom.block-gap, and blockGap
points at it. A bare var() passes the check, and the gap keeps its exact
value. 7.1 renders the same as before.
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.

1 participant