Treat theme.json projection as its own cascade origin

Open
#1,896 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
css, php, tailwindcss
Domain
frontend

Research direction

Start by tracing the existing guard for CSS-wide keywords through the theme.json projection path, then reproduce the Tailwind example described in the issue. Done means a layered declaration is not projected when a higher layer contests the same property for the same elements, including when the higher layer uses a class rule.

Written by the indexing model from the issue text.

Description

Global Styles is unlayered. A declaration that sits inside a cascade layer in source has a priority the author chose; projecting it into theme.json silently promotes it above every author layer.

#1865 — Tailwind preflight ships @layer base{h1{font-size:inherit}} precisely so @layer utilities{.text-5xl} can win. Projected into Global Styles, that deferral outranked the utility and every heading resolved to the inherited body size. Baking heading sizes then existed largely to work around a promotion we had caused.

Fixed narrowly: CSS-wide keywords inside a layer now stay source-owned.

Proposal: generalise it. A layered declaration should not project when a higher layer contests the same property for the same elements, whatever its value. The existing guard only covers the same target and property declared across multiple layers, and does not see a class rule in a higher layer.


AI assistance: analysis by Claude Sonnet 4.6 via opencode, derived from five fixes landed while importing a live Tailwind v4 site. Reviewed before filing.

Dominant language
PHP
Stars
15
Forks
2
Avg merge
2h 21m
Merged PRs (30d)
796

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.