Skip to content

Improve SVG Icon block for 1.4.8#50

Merged
wpgaurav merged 1 commit into
mainfrom
codex/improve-svg-icon-block
Jul 24, 2026
Merged

Improve SVG Icon block for 1.4.8#50
wpgaurav merged 1 commit into
mainfrom
codex/improve-svg-icon-block

Conversation

@wpgaurav

Copy link
Copy Markdown
Owner

What changed

  • register the SVG Icon block from block.json while preserving the existing block name and shortcode
  • add bounded px, em, and rem sizing, native color/spacing/anchor/class supports, original-color and monochrome modes, and decorative/informative accessibility controls
  • replace eager editor localization with a paginated REST picker, debounced search, recent-icon ordering, keyboard semantics, and missing-icon recovery
  • harden SVG sanitization, restrict local references and style properties, sanitize REST output, and prefix definition IDs per rendered instance
  • add focused sanitizer/rendering regression tests and update 1.4.8 documentation

Why

The previous block eagerly loaded the full icon library, hand-maintained block metadata, forced all path fills, offered only pixel sizing, and always hid icons from assistive technology. Its regex-based renderer could also duplicate root attributes and SVG definition IDs.

Validation

  • composer check (PHP lint, WordPress Coding Standards, 24 PHPUnit tests / 94 assertions)
  • JavaScript syntax validation with node --check
  • 1.4.8 distribution build and ZIP integrity check
  • WordPress Studio MCP on WordPress 7.0.2 / PHP 8.4
    • plugin installed from the built ZIP
    • block metadata and REST route registered
    • anonymous REST denied; editor REST request returned sanitized results
    • real editor validation: 5/5 and 2/2 blocks valid with no serialization changes
    • frontend verified at desktop and mobile sizes
    • decorative/informative ARIA, original/monochrome paint, px/em/rem sizing, anchor, custom class, spacing, and shortcode compatibility all passed

@wpgaurav
wpgaurav merged commit 74c08ab into main Jul 24, 2026
9 checks passed
@wpgaurav
wpgaurav deleted the codex/improve-svg-icon-block branch July 24, 2026 04:38
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.

1 participant