Skip to content

Add padding control for custom SVG icons - #346

Open
selul wants to merge 4 commits into
developmentfrom
codex/issue-344
Open

Add padding control for custom SVG icons#346
selul wants to merge 4 commits into
developmentfrom
codex/issue-344

Conversation

@selul

@selul selul commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an SVG Padding field whose untouched default is unset and displayed with a 0 placeholder.
  • Emit padding and box-sizing: border-box for any explicitly selected numeric value, including 0.
  • Leave existing icons with missing metadata, and new icons whose padding is untouched, with no padding-related CSS or default rendering changes.
  • Apply configured padding consistently in editor previews and frontend output.
  • Validate numeric icon style metadata and allow-list vertical alignment values before generating inline CSS.
  • Add regression coverage for positive, explicit zero, unset, missing, and unsafe stored values.

Will affect visual aspect of the product

YES, only after a user explicitly configures SVG padding.

Test instructions

  • Confirm an existing custom SVG menu icon has no padding-related inline CSS and renders unchanged after updating.
  • Create a new custom SVG icon and leave SVG Padding untouched; confirm it has no padding-related inline CSS.
  • Explicitly enter 0; confirm the preview and frontend emit padding:0px plus box-sizing:border-box.
  • Enter a positive value; confirm the preview and frontend emit that padding plus box-sizing:border-box without changing the configured outer width.
  • Store a non-numeric value for padding, width, or font size and confirm it is omitted from the generated inline style.

Verification

  • Focused PHPUnit: 3 tests, 11 assertions passed.
  • GitHub Actions PHP Lint and PHPUnit jobs passed.
  • PHP CodeSniffer passed under PHP 8.0; PHP syntax checks and git diff --check also passed.

Check before Pull Request is ready:

  • Regression tests are included in this PR.
  • The PHPUnit and PHP lint CI jobs pass.
  • PHP CodeSniffer passes under PHP 8.0.
  • The changed PHP follows the surrounding WordPress coding style.
  • Security and sanitization requirements have been reviewed.
  • A reviewer still needs to be assigned.

Closes #344.

@pirate-bot

pirate-bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Plugin build for 3506920 is ready 🛎️!

@selul
selul changed the base branch from master to development September 3, 2026 19:13
@pirate-bot pirate-bot added the pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add padding control setting for custom SVG menu icons

2 participants