Automattic / Automattic/blocks-engine
Preserve author selector provenance inside fallback HTML
- Dominant language
- PHP
- Stars
- 14
- Forks
- 2
- Avg merge
- 2h 10m
- Merged PRs (30d)
- 561
Description
## Problem
Author CSS type selectors are correctly rewritten to deterministic source-tag selectors, but descendants preserved inside generated custom blocks or bounded `core/html` islands do not receive the corresponding source-tag classes. The projected rule therefore cannot match the emitted markup.
On the Greek Corner homepage, the source reset gives footer contact paragraphs zero margin. Blocks Engine projects the rule through a generated `blocks-engine-source-p-*` selector, while the responsive footer custom-block payload retains `
` without that class. WordPress paragraph defaults then expand the four-row contact stack.
## Minimal reproduction
```html
.runtime p { margin: 0 }
Address
```
The form remains a bounded raw-HTML island. Before the fix, author CSS targets `.runtime :where(.blocks-engine-source-p-*)`, while the stored `
` has no generated source class.
The same mismatch occurs in high-confidence generated custom-block content such as repeatable collections.
## Acceptance
- Materialize source-tag and semantic projection classes in sanitized custom-block and `core/html` payloads.
- Keep diagnostics evidence and generic sanitization independent of transformer selector state.
- Keep generated block definitions and per-instance content attributes identical and deterministic.
- Preserve existing script, event-handler, and unsafe-URL sanitization.
- Keep native block serialization and ordinary prose behavior unchanged.
- Greek Corner footer contact rows match source vertical geometry on desktop and mobile.
Evidence tracker: Automattic/studio#3952. Related structural trackers: #868 and #905.
## AI assistance
OpenAI GPT-5.6 Sol via OpenCode compared computed source/WordPress rules, traced the custom-block payload boundary, built the minimal raw-HTML reproduction, and drafted this corrected issue description. Chris Huber remains responsible for the report.
Contributor guide
Research direction
Start with the custom-block and bounded core/html payload boundaries described in the issue, reproducing the minimal raw-HTML example and the Greek Corner footer case. Trace how source-tag and semantic projection classes are materialized while diagnostics, sanitization, native block serialization, and ordinary prose remain independent; done means deterministic classes and attributes are emitted and the footer geometry matches on desktop and mobile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100