Keep imported inline SVG editor-valid with explicit sizing; convert SVG-in-link to core/button#492
Merged
Merged
Conversation
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.
Problem
Imported inline
<svg>elements fell back tocore/htmlwith no explicit sizing. When the source page sized them via stylesheet rules that are not applied to the imported candidate, they rendered at intrinsic/oversized dimensions — the dominant contributor to visual-parity mismatch on SSI fixture-matrix fixtures (up to 96% pixel mismatch on SVG-heavy pages).Why not core/icon
An intermediate attempt routed inline SVG to
core/icon. The package test suite passed — but the real editor invalidated 4/7 matrix fixtures:core/iconis a dynamic block whose registered contract carries a registered icon name (WP_Icons_Registry), not arbitrary SVG markup (verified against wordpress-develop:wp-includes/blocks/icon/block.json,icon.php,class-wp-icons-registry.php). Package-level validation cannot catch this class of error becauseCanonicalSaveShapeValidatorintentionally skips dynamic blocks — only live editor validation surfaces it. That dead end is documented here so it isn't retried.Fix
core/html, and viewBox-only SVGs get explicitwidth/heightderived from the viewBox so rendering no longer depends on unapplied stylesheet rules.core/button.<use href="…#id">with no inlinable drawable content) remain a diagnostic fallback — the referenced symbol is outside the imported markup and would render broken.Verification
composer test(canonical + 203 parity fixtures + packaging).AI assistance