Preserve whole-element links: propagate wrapper hrefs onto native link-bearing blocks#484
Merged
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #260
Problem
<a href>wrapping block-level content (linked cards/tiles) converted tocore/groupwith an unsupportedhrefattribute that WordPress silently drops — the card was no longer clickable, and the loss was undetected.Change
core/imagegets native link attributes;core/heading/core/paragraph/core/list-itemget an inline<a>around text content; propagation recurses through layout containers.core/button,core/navigation*, ...) are never overwritten; the container keeps layout/className and never carries a bogushref.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