Skip to content

Icons: Scale artwork to better fill the 24×24 canvas - #84105

Closed
jameskoster wants to merge 9 commits into
trunkfrom
update/scale-icons-to-fill-canvas
Closed

jameskoster wants to merge 9 commits into
trunkfrom
update/scale-icons-to-fill-canvas

Conversation

@jameskoster

@jameskoster jameskoster commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What?

See #73784. Scale @wordpress/icons drawings by up to 1.25× about the 24×24 canvas centre so typical icons fill more of their artboard, and render icons at 20px by default so that larger artwork stays close to its previous visual size.

This does not add a cropped/IconUnboxed export. The viewBox stays 0 0 24 24 and stroke-width stays 1.5. The empty padding inside the artboard shrinks, and the rendered size shrinks with it.

Why?

Most icons sat at about 16 units across on the 24 canvas. With a colour background that extra space is invisible; without one, left-aligning an icon with text below it is hard because the visible path starts several units in from the SVG edge.

Leaving the drawings at 1.25× and still painting them at 24px would make every icon look larger than on trunk. 20/24 × 1.25 is about 1.04, so a 20px render keeps the visible size about the same. Once #84081 removes vector-effect="non-scaling-stroke", a 1.5 stroke in this viewBox paints at 1.25px at 20px, 1px at 16px, and 1.5px at 24px.

How?

  • Scale every path, circle, and rect about (12, 12). Cap each icon so stroked artwork stays within 22 units. About 80 icons already filled more of the canvas and grew by less than 1.25×. Seven already reached the cap and were left unchanged: addCard, addTemplate, html, insertBefore, postComments, postCommentsCount, postCommentsForm.
  • Snap endpoints to the 0.25 grid from the centre so symmetric icons stay symmetric. Small curved shapes (dots, knobs) scale as a rigid piece.
  • Leave the eight *-small variants and the wordpress mark unchanged.
  • Hand-fix cog: its inner ring is a second overlapping stroke, so after scaling the two strokes no longer met. The inner radius is now the outer radius minus 1.25 so they overlap again.
  • Change the default Icon size from 24 to 20 in @wordpress/icons, @wordpress/components, and @wordpress/ui, and set $icon-size to 20px. Hardcoded 24px icon sizes in the component packages, the block editor, the editor, and the site editor move to 20px with them.
  • Keep a 24px box where the size is not the icon glyph: the media thumbnail placeholder, collaborator avatars, the Icon block picker, and the block-list appender (it follows the small button). The document-inspector title icon gets a 2px block margin so it lines up with the 24px actions button beside it.
  • Existing Icon blocks keep their saved width and render these scaled drawings, so the glyph on the front end grows inside that width by up to 1.25× (less when the drawing was already near the 22-unit cap). The 20px default applies to interface icons, not to these blocks.
  • Add viewBox="0 0 24 24" to the Site Tagline and Icon block glyphs. They omitted a view box, so the 20px size left the artwork centered at 12px instead of 10px.

Testing Instructions

  1. Open the Icons Storybook story (packages/icons) and scan the full library. The default render is now 20px.
  2. In the post editor, check the block toolbar, the inserter grid, list view, the document inspector title, and a dropdown menu that shows icons next to labels. Icons should be about the same visual size as on trunk, with less empty space inside the artboard.
  3. Compare families that should stay optically matched: heading levels, justify/align, arrows, seen/unseen.
  4. Confirm closeSmall, chevronDownSmall, and other *Small icons are still distinctly smaller than their regular versions.
  5. With Icons: Experiment with proportional stroke scaling #84081 applied, confirm a 20px icon paints a 1.25px stroke and a 24px icon still paints 1.5px.
  6. On the front end, view a page that already contains Icon blocks. The saved width stays the same and the glyph inside it is larger than on trunk. In the inserter, confirm the Site Tagline and Icon block glyphs stay centered in their 20px box.

Testing Instructions for Keyboard

No interaction changes. Tab through a toolbar and a menu that contain icons and confirm focus rings and hit targets are unchanged.

Screenshots or screencast

Library before

Screenshot 2026-10-06 at 10 38 59

Library after

Screenshot 2026-10-06 at 10 39 26

Editor before

Screenshot 2026-10-08 at 12 15 45

Editor after

Screenshot 2026-10-08 at 12 15 31

Reviewers: please look especially at cog (inner ring), letterform icons (headingLevel*, typography), frontend Icon blocks (saved width, larger drawing), and any consumer that used a negative margin to optically balance an icon. components-menu-item still applies margin-left: -2px for that reason.

For anyone keen to visually inspect the vectors here's a Figma.

Use of AI Tools

A Cursor agent wrote the one-off scaling script, ran it over the library, updated the default render size and the call sites that hardcoded 24px, updated snapshots, and drafted this PR. The cog inner-ring fix and the decision to use a uniform 1.25× factor with a 22-unit cap were reviewed against a full contact sheet of original vs scaled icons.

@jameskoster
jameskoster requested review from a team, ellatrix and fabiankaegy as code owners October 6, 2026 09:30
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: mattmiklic <mattmiklic@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: -2.99 kB (-0.03%)

Total Size: 8.97 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 57.9 kB +3 B (+0.01%)
build/modules/core-actions/post_type_supports.min.js 6.17 kB -35 B (-0.56%)
build/modules/core-actions/wp_block.min.js 6.36 kB +6 B (+0.09%)
build/modules/core-fields/attachment.min.js 45.3 kB -76 B (-0.17%)
build/modules/core-fields/post_type_supports.min.js 81 kB -55 B (-0.07%)
build/modules/core-fields/wp_template_part.min.js 40.1 kB -153 B (-0.38%)
build/modules/core-fields/wp_template.min.js 7.48 kB -129 B (-1.7%)
build/modules/edit-site-init/index.min.js 1.64 kB -62 B (-3.65%)
build/modules/workflow/index.min.js 88.3 kB -5 B (-0.01%)
build/scripts/block-directory/index.min.js 55.2 kB -159 B (-0.29%)
build/scripts/block-editor/index.min.js 603 kB -495 B (-0.08%)
build/scripts/block-library/index.min.js 442 kB +80 B (+0.02%)
build/scripts/commands/index.min.js 21.9 kB +1 B (0%)
build/scripts/components/index.min.js 370 kB -85 B (-0.02%)
build/scripts/core-commands/index.min.js 3.86 kB -80 B (-2.03%)
build/scripts/core-data/index.min.js 79.2 kB -50 B (-0.06%)
build/scripts/customize-widgets/index.min.js 60.4 kB -20 B (-0.03%)
build/scripts/edit-post/index.min.js 52.7 kB +9 B (+0.02%)
build/scripts/edit-site/index.min.js 420 kB -296 B (-0.07%)
build/scripts/edit-widgets/index.min.js 67.2 kB -143 B (-0.21%)
build/scripts/editor/index.min.js 614 kB -208 B (-0.03%)
build/scripts/format-library/index.min.js 89.3 kB -249 B (-0.28%)
build/scripts/media-utils/index.min.js 261 kB -97 B (-0.04%)
build/scripts/notices/index.min.js 52.1 kB -655 B (-1.24%)
build/scripts/patterns/index.min.js 14.2 kB -64 B (-0.45%)
build/scripts/plugins/index.min.js 3.07 kB -132 B (-4.13%)
build/scripts/preferences/index.min.js 3.33 kB +6 B (+0.18%)
build/scripts/widgets/index.min.js 70.3 kB -9 B (-0.01%)
build/styles/block-editor/content-rtl.css 5.96 kB +1 B (+0.02%)
build/styles/block-editor/content-rtl.min.css 4.42 kB +3 B (+0.07%)
build/styles/block-editor/content.css 5.96 kB +1 B (+0.02%)
build/styles/block-editor/content.min.css 4.42 kB +2 B (+0.05%)
build/styles/block-editor/style-rtl.css 20.6 kB +16 B (+0.08%)
build/styles/block-editor/style-rtl.min.css 17.5 kB +15 B (+0.09%)
build/styles/block-editor/style.css 20.6 kB +17 B (+0.08%)
build/styles/block-editor/style.min.css 17.5 kB +18 B (+0.1%)
build/styles/components/style-rtl.css 16.9 kB -3 B (-0.02%)
build/styles/components/style-rtl.min.css 14.3 kB -2 B (-0.01%)
build/styles/components/style.css 16.9 kB -5 B (-0.03%)
build/styles/components/style.min.css 14.3 kB -1 B (-0.01%)
build/styles/edit-widgets/style-rtl.css 5.24 kB +2 B (+0.04%)
build/styles/edit-widgets/style-rtl.min.css 3.84 kB +4 B (+0.1%)
build/styles/edit-widgets/style.css 5.23 kB +2 B (+0.04%)
build/styles/edit-widgets/style.min.css 3.84 kB +5 B (+0.13%)
build/styles/editor/style-rtl.css 31.3 kB +29 B (+0.09%)
build/styles/editor/style-rtl.min.css 26.8 kB +17 B (+0.06%)
build/styles/editor/style.css 31.4 kB +27 B (+0.09%)
build/styles/editor/style.min.css 26.7 kB +16 B (+0.06%)
build/styles/widgets/style-rtl.css 2.27 kB -1 B (-0.04%)
build/styles/widgets/style-rtl.min.css 1.28 kB -1 B (-0.08%)
build/styles/widgets/style.min.css 1.29 kB +1 B (+0.08%)

b31ebba Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f8c184a trunk % Change
timeToFirstByte 53.1 ms +5.18% -1.98% 55.2 ms +2.72% -4.98% -3.8%
largestContentfulPaint 92 ms +4.35% -2.17% 90 ms +4.44% -2.22% 2.22%
lcpMinusTtfb 39.85 ms +9.54% -12.3% 35.3 ms +15.86% -7.08% 12.89%
wpBeforeTemplate 28.2 ms +3.87% -0.74% 28.67 ms +1.99% -2.65% -1.64%
wpTemplate 20.82 ms +5.52% -2.45% 21.71 ms +4.56% -5.62% -4.1%
wpTotal 49.27 ms +5.91% -2.31% 51.25 ms +3% -4.6% -3.86%
wpMemoryUsage 7.64 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f8c184a trunk % Change
timeToFirstByte 45.85 ms +3.38% -3.16% 45.8 ms +9.72% -1.86% 0.11%
largestContentfulPaint 100 ms +0% -4% 100 ms +6% -0% 0%
lcpMinusTtfb 53.25 ms +1.88% -2.63% 54.6 ms +3.21% -1.65% -2.47%
wpBeforeTemplate 26.1 ms +7.62% -0.96% 26.15 ms +4.21% -1.57% -0.19%
wpTemplate 16.3 ms +2.7% -4.36% 16.77 ms +2.09% -5.66% -2.8%
wpTotal 42.87 ms +3.43% -3.31% 42.66 ms +10.88% -1.71% 0.49%
wpMemoryUsage 6.33 MB +0% -0% 6.30 MB +0% -0% 0.57%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f8c184a trunk % Change
mediaProcessingJpeg 397.59 ms +1.06% -0.24% 398.54 ms +0.27% -1.21% -0.24%
mediaProcessingAvif 6113.56 ms +0.35% -0.12% 6077.17 ms +0.23% -0.15% 0.6%
mediaProcessingJpegToAvif 4232.84 ms +0.3% -0.31% 4197.88 ms +0.13% -0.11% 0.83%

media-upload

Metric f8c184a trunk % Change
jpegUploadProcessing 1948.7 ms +0.63% -0.23% 1951.51 ms +0.16% -0.31% -0.14%
pngUploadProcessing 198.27 ms +25.32% -5.84% 176.37 ms +8.33% -9.79% 12.42%
largeJpegUploadProcessing 1952.45 ms +1.25% -0.43% 1952.37 ms +0.36% -0.38% 0%
multipleImageUploadProcessing 2034.8 ms +1.11% -0.58% 2021.23 ms +2.16% -1.02% 0.67%

post-editor

Metric f8c184a trunk % Change
serverResponse 538.72 ms +5.03% -8.74% 507.07 ms +1.41% -4.42% 6.24%
firstPaint 406.82 ms +31.84% -37.15% 444.42 ms +15.8% -37.2% -8.46%
domContentLoaded 1246.22 ms +3.11% -1.67% 1216.18 ms +1.16% -3.99% 2.47%
loaded 1247.61 ms +3.08% -1.66% 1217.3 ms +1.15% -3.97% 2.49%
firstContentfulPaint 509.18 ms +5.71% -4.22% 518.25 ms +1.95% -7.69% -1.75%
firstBlock 3912.79 ms +3.96% -2.37% 3782.46 ms +3.27% -1.6% 3.45%
type 19 ms +2.47% -3.58% 18.64 ms +3.59% -3.38% 1.93%
typeWithoutInspector 19.66 ms +5.85% -4.88% 18.91 ms +3.97% -5.34% 3.97%
typeWithTopToolbar 26.15 ms +5.85% -4.13% 22.49 ms +7.29% -6.4% 16.27%
typeContainer 8.84 ms +12.78% -6% 9.47 ms +10.03% -7.71% -6.65%
focus 132.28 ms +8.13% -3.48% 125.38 ms +4.81% -5.2% 5.5%
firstFocus 250.75 ms +0% -0% 242.38 ms +0% -0% 3.45%
selectAll 592.73 ms +2.6% -0.3% 591.99 ms +6.1% -2.78% 0.13%
listViewOpen 82.29 ms +4.56% -9.38% 75.62 ms +4.54% -4.34% 8.82%
inserterOpen 42.69 ms +11.95% -8.53% 43.23 ms +6.11% -7.29% -1.25%
inserterHover 12.28 ms +7.74% -5.54% 12.28 ms +4.97% -14.41% 0%
inserterSearch 7.92 ms +15.03% -6.57% 8.76 ms +6.16% -2.97% -9.59%
loadPatterns 644.15 ms +2.88% -1.97% 666.43 ms +7.1% -0.52% -3.34%
wpTotal 527.92 ms +5.24% -8.9% 496.37 ms +1.42% -4.5% 6.36%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.25%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric f8c184a trunk % Change
serverResponse 514.97 ms +4.59% -3.09% 534.09 ms +2.62% -2.51% -3.58%
firstPaint 264.71 ms +16.66% -3.12% 273.84 ms +6.08% -5.99% -3.33%
domContentLoaded 1330.48 ms +0.98% -1.14% 1343.33 ms +0.81% -0.65% -0.96%
loaded 1331.54 ms +1% -1.1% 1344.39 ms +0.82% -0.66% -0.96%
firstContentfulPaint 523.18 ms +2.55% -2.96% 550.34 ms +1.21% -1.23% -4.94%
firstBlock 5187.85 ms +0.99% -0.79% 5206.32 ms +1.31% -0.87% -0.35%
type 22 ms +16.05% -4.82% 19.32 ms +7.09% -4.45% 13.87%
navigate 140.71 ms +5.33% -8.09% 133.85 ms +18.19% -6.26% 5.13%
loadPatterns 1412.08 ms +6.95% -5.73% 1387.58 ms +4.8% -3.23% 1.77%
loadPages 1070.93 ms +4.48% -2.88% 1051.39 ms +2.02% -1.35% 1.86%
wpTotal 504.87 ms +4.57% -3.2% 524.03 ms +2.69% -2.57% -3.66%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.28%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

b31ebba Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Regression: updating a specific option will only change its value and will not corrupt others in /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=223"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/223", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/222", "id": 222, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-223", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-20T13:19:08", "date_gmt": "2026-10-20T13:19:08", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/af6c655b-5899-48fa-911b-df5e3085b91f.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/af6c655b-5899-48fa-911b-df5e3085b91f.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "af6c655b-5899-48fa-911b-df5e3085b91f.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/af6c655b-5899-48fa-911b-df5e3085b91f.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/af6c655b-5899-48fa-911b-df5e3085b91f.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-20T13:19:08", "modified_gmt": "2026-10-20T13:19:08", "ping_status": "closed", "post": 222, "slug": "af6c655b-5899-48fa-911b-df5e3085b91f", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/af6c655b-5899-48fa-911b-df5e3085b91f.png", "status": "inherit", "template": "", "title": {"rendered": "af6c655b-5899-48fa-911b-df5e3085b91f"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45
should show the edited content after revert, clicking undo in the header toolbar, save and reload (Site Editor v2) in /test/e2e/specs/site-editor/template-revert.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → GET http://localhost:8889/wp-json/wp/v2/templates
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: aa3c29e2a9
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1792674585%7C17w3bhmY4NHDJWK3YqhTPoXtPhp6L7tBKRDSO6rh3vo%7C9377a17466898324d2469a32cf6add301a18996de6c50bbea6f4d7e08de2335a; wp-settings-time-1=1792502513

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:112:39)
    at RequestUtils.deleteAllTemplates (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/templates.ts:35:31)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-revert.spec.js:24:22

b31ebba Run

@github-actions github-actions Bot added [Package] Components /packages/components [Package] Editor /packages/editor [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] Icons /packages/icons labels Oct 6, 2026
@jameskoster
jameskoster marked this pull request as draft October 6, 2026 09:32

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update snapshots, too.

Apart from that, I believe this will mostly need a design approval, more than code/technical approval.

Comment thread packages/icons/CHANGELOG.md Outdated

### Enhancements

- Scale icon artwork by up to 1.25× so icons better fill their 24×24 canvas. `*-small` variants and the WordPress mark are unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing PR reference + link

@jameskoster

Copy link
Copy Markdown
Contributor Author

@ciampo you're too quick, I'm still working on this haha. But since you commented; I agree we need a thorough design review. The larger icons look a little off in the Editor which was expected. I'm going to try reducing from 24px to 20px icons which should produce something closer to the existing appearance while fixing the bounding box issue.

@ciampo

ciampo commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

you're too quick, I'm still working on this haha

Sorry, didn't mean to review too early. I got the ping while I was going through my queue and I took a look 😅

I'm going to try reducing from 24px to 20px icons which should produce something closer to the existing appearance while fixing the bounding box issue.

Nice! I guess one thing to keep in mind is to optimize for the size that gives us the shapes that we want with the less need for a lot of SVG decimals and rescaling? Ie. if we use our icons at 20px for the majority of time, there could be added value in defining them at 20px viewbox to avoid re-sizing them (which could introduce subpixel artefacts).

Is the stroke width changing to 1.25px too, to keep the same proportions? Assuming we'll enable stroke width scaling?

@jameskoster

jameskoster commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Yes the stroke-width would change once #84081 lands, which might complicate things a bit because most icons in the editor currently render at 24/1.5px. It may be that interactive icons (icons in buttons) need to retain the 1.5px weight even at 20px 🤔 Let's review once #84081 is merged.

@github-actions github-actions Bot added [Package] Edit Site /packages/edit-site [Package] Base styles /packages/base-styles [Package] Fields /packages/fields [Package] UI /packages/ui labels Oct 6, 2026
@ciampo

ciampo commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

#84081 has landed.

most icons in the editor currently render at 24/1.5px

If we rewrite the icons to use a 20x20 viewport and a 1.25 stroke width, won't they continue to render at 24/1.5px anyway, thus keeping the same behaviour as on trunk?

It may be that interactive icons (icons in buttons) need to retain the 1.5px weight even at 20px

If the point above makes sense, this would have been an aspect to consider regardless of this PR?

@jameskoster
jameskoster force-pushed the update/scale-icons-to-fill-canvas branch from 4096586 to f908140 Compare October 8, 2026 08:17
@jasmussen

Copy link
Copy Markdown
Contributor

I would love @mattmiklic's eye on this as far as bringing these back into Figma. I'm a bit concerned that we are changing every single icon dimensions and sizes, I think it's a larger visual change than we might think. Every vector handle across all the icons I hand-placed on precise integer coordinates so as to alias the best across the set.

@jameskoster

jameskoster commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

There's a Figma here.

Also dropping a summary from a lengthy conversation with AI about icon crispness:

Conversation with AI **Icons are slightly soft at the sizes we use, and one shared drawing cannot be crisp at 16px, 20px, and 24px without changing the stroke weight.**

A crisp line fills whole physical pixels. Ours is 1.5 units thick in a 24-unit box, so the painted thickness depends on the render size: 1px at 16, 1.25px at 20, and 1.5px at 24. A fractional thickness fades at the edge.

  • 24px on a low-density screen. The line is 1.5 physical pixels, so the extra half pixel is a real blur. Trunk has this today.
  • 24px on a retina screen. The line is 3 physical pixels, which is fine, but most of our straight lines sit between pixels, so the edge is faintly soft. Hard to see.
  • 20px, the new default. The line is 1.25px. That is fractional on both low-density and retina screens, so it is soft in both places.
  • 16px. The thickness is a whole pixel, but the lines sit in the wrong place, so they still spill.

Trunk and this branch are the same in this respect. Scaling the artwork does not fix it or make it worse. Those are still one drawing scaled to fit.

Sharp at all three sizes means a separate drawing for each size, with a 1px or 2px stroke snapped to that grid. Curves will still fade a little. The other option is to keep one drawing and round the stroke to a whole pixel at the size we use most:

  • 1px at 20px makes the default size crisp, and makes the stroke lighter (1.25px down to 1px). 16px and 24px stay slightly soft.
  • 2px at 24px makes 24px crisp, and makes the stroke heavier (1.5px up to 2px). That is a bigger change. 16px and 20px stay slightly soft.

The TLDR is that icons are slightly soft on trunk and on this PR. Making them crisp would be a separate effort. So for now the review task is:

  1. Compare the actual UI.
  2. Check the vectors in Figma

And to re-iterate; the main objective of this work is to achieve better alignment of text and icons on the vertical axis without resorting to hacks. It's not perfect, but it's about as good as it can be while leaving some space for optical balance. Top is trunk, bottom is this PR:

Screenshot 2026-10-08 at 12 21 46

@mattmiklic

Copy link
Copy Markdown
Contributor

I would love @mattmiklic's eye on this as far as bringing these back into Figma.

I don't think updating the Icons figma library would be difficult. It sounds like the changes would have a broad reach, but be fairly mechanical. Once the code is settled, we’d import the drawings, scale affected instances to 20px, and mirror the specified spacing changes. The main effort is finding all affected consumers and verifying that updates preserve overrides and layout.

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More snapshots needing updating

Comment thread packages/ui/src/notice/style.module.css Resolved

.components-color-list-picker__swatch-color {
// Match the 24px size of the `swatch` icon (used when no color is set)
// Match the 20px size of the `swatch` icon (used when no color is set)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I gather, ColorIndicator is already 20px wide, so these margins still reserve 24px while the unset icon now reserves 20px. We may be able to remove the margins so the label doesn't move 4px when a color is set or cleared

@jameskoster
jameskoster force-pushed the update/scale-icons-to-fill-canvas branch from 8e46e96 to 0af0ffa Compare October 14, 2026 10:35

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the Site Tagline and Icon block glyphs omit viewBox, so the new 20px dimensions leave their artwork centered at 12px instead of 10px. Could we add viewBox="0 0 24 24" to those two SVGs so they scale and stay centered?

Also, existing Icon blocks also pick up the larger drawings while keeping their saved width. Could we include frontend Icon blocks in the design review and note this effect in the PR description?

@jasmussen

Copy link
Copy Markdown
Contributor

I'll reshare that I'm a little concerned with the approach generally taken here. I think if we are to scale up the icons, we should do it manually, and review it overall. A reflection from the recent merge of a stroke-redesign of 300+ icons was that, only the icons that did not receive any visual changes at all still felt coherent at the end of the effort: icons around headings, typography, bold, italic, even if the updates were relatively minuscule, their impact felt substantial, so I scrambled to address it. I worry that even if we mechanicaly think of these changes as being small, the holistic impact hasn't been fully measured. Still not sharing that in a blocking sense, because I'm simultaneously convinced that there's some technical nuance to all this that I'm missing, so if anything it's mostly: proceed with caution!

@ciampo

ciampo commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

How can we proceed, though? Merge early in the 7.3 cycle, gather feedback, address?

@jasmussen

Copy link
Copy Markdown
Contributor

How can we proceed, though? Merge early in the 7.3 cycle, gather feedback, address?

As the resident "concerned contributor", it's only fair that I elaborate on what concerns me so we can actually act on it. Apologies if I've been fuzzy, so let me clear my thoughts.

The icons have all been deliberately designed on a 24px canvas over several years. Even if they were adjusted to be stroke-based recently, much of the initial character has remained, and the major changes have been to address optical balancing and inconsistencies, where we are now closer to a very coherent set than we've been for ages. We still have balancing and improvement work to do, including decisions on fills vs. strokes-only as well as some deprecations, so making the set coherent and better remains an ongoing task.

So I think the main concern I have really is about that unfinished maintenance task. Every code-point of the 300+ vectors were manually placed on rounded coordinates so as to alias the best they could in the 24px artboard. It's ongoing, but now that the conversion is complete, it's easier to adjust those coordinates if we have to. I think that's my main concern: if we use a bulk script to convert every codepoint, the source files will be changed in a way where I worry maintenance will go from where it is at present: organised and understandable as far as math values, to one of confusion and harder maintenance.

I have heard the counter-argument: the block toolbar after this change will look identical, because even if the artwork is scaled up to use more of the artboard, the artboard itself will be scaled down by the same factor, and combined with consistent stroke scaling it means icons should theoretically be identical. But I guess I mostly don't trust that they will alias the same when actually changing the artwork: there are subtle alignment pieces across rows of icons where fuzz on just one edge of a stroke will suddenly stand out in contrast to more deliberately placed fuzz.

To be fair, I could be overly concerned about a non-issue. Maybe it's fine? But it goes back to: I don't understand what problem this is solving through scaling the artwork. If the challenge is to provide the icons "without bounding box spacing", are there not ways where we can much less destructively change the bounding box itself? It seems like we're looking at a relatively impactful change for consumers, and let me know if the following is not correctly understood:

  • If we proceed with scaling the artwork, if consumer icons 24px after this change, suddenly all the artwork is larger.
  • If we proceed with reducing the bounding box without changing the artwork, either buttons get smaller as the icon gets smaller, or we're in the same place: icons remain 24x24 so the artwork is also scaled up due to the smaller viewbox inside.

In both cases, this would require some migration. So what I'm saying is that if there are any ways we can accomplish the bounding box challenge without script-changing the artwork, I'd personally feel safer. Is there an option for a prop on the bounding box? inline?

That's still not a blocker, so if we do proceed with this, if there's broad agreement and I'm the only voice against it, then I ask we proceed very carefully so that if visual regressions or trickier Figma editing of new source files emerges as a problem, we can carefully revert.

Is that fair? I'm happy to hop on a call if I'm still missing nuance, and I appreciate your patience with this.

@ciampo

ciampo commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@joen potentially we could work on preparing (visual) tests to render before/after icons at multiple sizes to uncover any px differences on this PR ? Would that help us to gain confidence about this change?

@jasmussen

Copy link
Copy Markdown
Contributor

Would that help us to gain confidence about this change?

Maybe. Don't do it just for me if I'm the only one being concerned here, or if there's something I've fundamentally misunderstood. To be reductive, I'm worried about having to draw new icons like I have to in a moment, opening the Figma source file, and finding box corners aligned to odd numbers like 3.43 rather than rounder numbers like 4.75.

@jameskoster

Copy link
Copy Markdown
Contributor Author

@jasmussen the problem we're solving is covered in this comment, and in #65786 originally.

I understand the concerns, but like @ciampo says it's difficult to know how to proceed until those concerns are more concrete/specific. If you have time please take a look at the Figma, and ideally build this branch and check UIs that make use of the icons. If anything specific stands out please leave details in a comment for me to investigate.

@jasmussen

Copy link
Copy Markdown
Contributor

I'll do a deep dive later today. 🙏

jameskoster and others added 9 commits October 20, 2026 10:32
Most icons sat at about 16 units across, which made flush alignment with nearby text harder than it needs to be. Scale each drawing by up to 1.25 about the canvas centre, keeping stroke width and the small variants unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
…vious visual size.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…con.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…on are both 20px.

Co-authored-by: Cursor <cursoragent@cursor.com>
…entered at 20px.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jasmussen

Copy link
Copy Markdown
Contributor

OK, reviewed all the material. I'll be as clear as I can, then I'll step away.


The problem is real, this image shows it well.

The approach taken, to scale up the artwork and subsequently scale down the icon can work. Shown here, 1/original, 2/new icon, 3/new icon scaled back down.

image

I'm not quite sure about the exact scale factor to scale the icon down again, shown here at 20x20, The problem becomes clearer when turning on pixel-preview:

image

It's valid to argue this fuzz is effectively negligible on modern screens, and that the behavior is similar to that of fonts: any scale should be possible and there will always be fuzz on some non-integer scales.

So let's compare the branch (top) with trunk (bottom):

image

You can ignore the plus change, trunk has some tweaks to its behavior.

It looks close. And maybe the fuzz I'm seeing is just me holding this work to unreasonable standards. But the image is a good comparison, because when we zoom in, we see the tiniest differences in edge enhancement notably on the alignment icons which are meant to be carved from the same stone:

image

It's clearer still if we go to 1x screens—which yes we can choose to ignore—but it is to say, embracing this means a deliberate tradeoff in default fidelity in the editor:

image

The above tickles my inner "paint the back of the fence" perfectionist which is why I'm advocating for a viewbox/artboard change instead of artwork scale change. But, it is not a hill I want to die on, let alone fight on, so I invite you all to dismiss all of the above. I now have it out of my system, the demons are exorcised, and this room is clear.

But if you do choose to proceed in this fashion, I do have one conundrum I'd love to solve if we can. One that I am realising also applies to the current @wordpress/icons Figma package. Corner radii in the SVGs in the Scaled Icons Figma file no longer use Figma corner radius for boxes. Before:

image

After:

image

The corner radius is now baked into the SVG itself. Of course it has to be in the shipping SVG icons, but it means the source files are now harder to maintain. And it's not just the corners on the outer boxes, it's also the curvature of the mountain range in the above image, all square lines with radii in Figma, multiple lines with curvature in the SVG. It's used in a lot of the icons:

image

Is there any way this tooling can retain those Figma corner radii? Those corner radii are intact in this file (from my drafts so if a reader of this thread without access wants to see that particular file you can download this copy). Tooling is magical these days, so I imagine it might be possible. 🤞


Where does that leave us? My apprehension remains, I feel there is a better approach, and those opinions are okay to ignore if you still feel this is the correct path forward. But if we do move forward, let's explore if we can retain the Figma corner radius. Is that fair?

@jameskoster
jameskoster force-pushed the update/scale-icons-to-fill-canvas branch from ed77483 to b31ebba Compare October 20, 2026 13:04
@jameskoster

Copy link
Copy Markdown
Contributor Author

Thanks for taking the time to review in detail. What I'm seeing is a little softness on trunk, and slightly increased softness on this PR. So it's a question of whether the slightly increased softness is worth it to fix #73784, or if we should manually redraw the entire set again 🙈 I don't see another option that doesn't involve imperfect/confusing hacks.

To my eye, at 100% zoom I don't see any meaningful difference, so I'd argue it is worth it. But I appreciate this is highly subjective so welcome more feedback from more sets of eyes :)

@jasmussen

Copy link
Copy Markdown
Contributor

or if we should manually redraw the entire set again

If that's an option you would entertain, I'd genuinely gladly help do that, 300+ icons once more. It's easier the second time because they're strokebased now. The thought scares me less than the alternative, honestly.

Not saying anything definitive one way or the other, I've had plent of say now, so I'll also simply invite more eyes.

@mattmiklic

mattmiklic commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The above tickles my inner "paint the back of the fence" perfectionist which is why I'm advocating for a viewbox/artboard change instead of artwork scale change. But, it is not a hill I want to die on, let alone fight on, so I invite you all to dismiss all of the above. I now have it out of my system, the demons are exorcised, and this room is clear.

Just want to mention you're not alone on this point. Pixel hinting was non-negotiable before hi-dpi displays, but there's still value in it because differences in resolution, screen size, and viewing distance all mean that the fuzziness can be amplified in some circumstances. I'm not super opinionated on the method used to get there, but I'd hope the any changes keep them as sharp as they currently are, since so much care was put into that.

But if you do choose to proceed in this fashion, I do have one conundrum I'd love to solve if we can. One that I am realising also applies to the current @wordpress/icons Figma package. Corner radii in the SVGs in the Scaled Icons Figma file no longer use Figma corner radius for boxes.

This is a good point, and I don't want to get too into something that may be tangential to this discussion. But in the @wordpress/icons Figma I've been treating the SVGs in code as the "source of truth", but with the move to stroke-based icons maybe that's not the correct strategy anymore, and those icons should come directly from the Figma where they were originally drawn. That's something I could change going forward, so whatever improvements are made to the Figma originals are synced to the Figma library.

@jameskoster

Copy link
Copy Markdown
Contributor Author

If y'all have the time/will/energy to redraw the icons again please go ahead 🙏 Pending that I'll set this PR as a draft, feel free to takeover. Or if you prefer to start a new branch then I'll close this PR.

@jameskoster

Copy link
Copy Markdown
Contributor Author

It seems that redrawing the icons is the preference here so I'm going to close this PR.

@jameskoster jameskoster closed this Nov 4, 2026
@t-hamano
t-hamano deleted the update/scale-icons-to-fill-canvas branch November 5, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Base styles /packages/base-styles [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Components /packages/components [Package] Edit Site /packages/edit-site [Package] Editor /packages/editor [Package] Fields /packages/fields [Package] Icons /packages/icons [Package] UI /packages/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants