Skip to content

Preserve whole-element links: propagate wrapper hrefs onto native link-bearing blocks#484

Merged
chubes4 merged 1 commit into
trunkfrom
fix/260-whole-element-links
Jul 3, 2026
Merged

Preserve whole-element links: propagate wrapper hrefs onto native link-bearing blocks#484
chubes4 merged 1 commit into
trunkfrom
fix/260-whole-element-links

Conversation

@chubes4

@chubes4 chubes4 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #260

Problem

<a href> wrapping block-level content (linked cards/tiles) converted to core/group with an unsupported href attribute that WordPress silently drops — the card was no longer clickable, and the loss was undetected.

Change

  • Propagate the wrapper link deterministically onto native link-bearing inner blocks: core/image gets native link attributes; core/heading/core/paragraph/core/list-item get an inline <a> around text content; propagation recurses through layout containers.
  • Blocks that manage their own link destination (core/button, core/navigation*, ...) are never overwritten; the container keeps layout/className and never carries a bogus href.
  • When no inner block can carry the link, a structured source link wrapper dropped / content no longer navigable finding is emitted with source selector and href for downstream repair loops.

Coverage

Parity fixtures: propagated card link, button-like anchor, no-href group contract, dropped-link finding. composer test (canonical + parity + packaging) green locally.

Provenance

Implemented by an autonomous cook on Homeboy Lab; the patch was salvaged from the lab workspace after an infrastructure gap (Extra-Chill/homeboy#7370) prevented normal artifact capture, then verified locally.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (GLM 5.2) via Homeboy agent-task cook
  • Used for: Drafted the implementation and fixtures autonomously from a task brief; Chris reviewed, verified gates locally, and owns the change.

… link-bearing blocks

When an <a href> wraps block-level content (a linked card/tile), the
transformer previously emitted core/group with an unsupported href
attribute that WordPress silently drops, leaving the card unclickable.

Propagate the wrapper link deterministically instead:
- core/image children receive native link attributes
- core/heading, core/paragraph, and core/list-item children receive an
  inline <a> around their text content
- propagation recurses through layout containers; blocks that manage
  their own link destination (core/button, core/navigation, ...) are
  never overwritten
- the container keeps layout/className and never carries a bogus href

When no inner block can carry the link, emit a structured
'source link wrapper dropped / content no longer navigable' finding
with the source selector and href so downstream repair loops can act.

Adds parity fixtures for propagated card links, button-like anchors,
the no-href group contract, and the dropped-link finding.

Fixes #260
@chubes4 chubes4 merged commit 8ffabe9 into trunk Jul 3, 2026
1 check passed
@chubes4 chubes4 deleted the fix/260-whole-element-links branch July 3, 2026 12:43
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.

Whole-element links lost: <a> wrapping a block (e.g. card) → core/group with a bogus 'href' attribute (ignored) → no longer clickable

1 participant