Skip to content

Button.Icon will clip certain icons #78595

Closed

Description

@mirka

Problem

We currently have a somewhat hacky viewbox tweak in Button.Icon to fit @wordpress/icons icons nicely into a 16px square.

viewBox="4 4 16 16"

Certain library icons have visible portions outside this 4px-inset view box, and thus will be clipped.

With some raster tests, I was able to identify a list of affected icons.

List of affected icons

(☝️ This is just a preview, see the full list on StackBlitz)

While there are some clipped icons that are less noticeable and we can maybe let slide, there are still dozens of icons that will not be usable in the current state.

Proposed fix

Two possible strategies to address:

  1. Find a better compromise (e.g. drop the viewbox hack and add a margin offset in CSS, or tweak the viewbox hack so they're less problematic with these flagged icons).
  2. Redraw the flagged icons.

@WordPress/gutenberg-components @WordPress/gutenberg-design

Activity

  1. added
    [Type] Bug
    [Package] UI
    on May 22, 2026
  2. added
    [Status] In Progress
    on May 24, 2026
  3. ciampo commented on May 25, 2026

    @ciampo
    Contributor

    Are all @wordpress/icons expected to be 24px and have a 4px empty padding around the main glyph? That could tip the balance towards redraing the flagged icons.

    Otherwise, we can try the negative margin hack (as per #78614), although it will still cause sub-optimal layouts with those problematic icons — instead of clipping, they will just create incosistent spacing withing button

  4. jameskoster commented on May 26, 2026

    @jameskoster
    Contributor

    Another casualty of #65786. Although not perfect the negative margin approach seems the quickest win.

  5. jasmussen commented on May 26, 2026

    @jasmussen
    Contributor

    They are not always expected to have 4px padding, because the guidelines are optically balanced, not physically. E.g. three icons, one square, one horisontal rectangle, one vertical rectangle, can be optically balanced because of their perceived volume, while still have different dimensions. It sounds like the negative margin approach might allow the contents to go outside the overflow, in which case that would adhere to the optical spirit, probably.

    I will note that a few of those icons will need to be redesigned regardless. These are hurriedly ported dashicons we never got to replace:

    • keyboardClose (darker than keyboard)
    • insertBefore
    • insertAfter

    These icons are not designed according to wordpress icon principles, and may be material icons:

    • offline

    There are more icons in both those two categories above, but for the moment I focused only on those you flagged as clipped.

  6. mirka commented on May 26, 2026

    @mirka
    MemberAuthor

    Out of the those, these two can perhaps be quickly fixed for mispositioning within the viewbox, even if we need to redraw them later:

    Insert before and after icons
  7. moved this to 📋 Iteration/Tracking Issues in WordPress 7.0 Editor Taskson May 26, 2026
  8. moved this from 📋 Iteration/Tracking Issues to 🗣️ In Discussion / Needs Decision in WordPress 7.0 Editor Taskson May 26, 2026
  9. aaronjorbin commented on May 26, 2026

    @aaronjorbin
    Member

    Adding to WordPress 7.0 editor tasks board so that any eventual fix can be considered for backporting to WordPress 7.0

  10. mirka commented on May 26, 2026

    @mirka
    MemberAuthor

    @aaronjorbin I think we're good, there should be no usages of Button.Icon (from @wordpress/ui) in WP 7.0.

  11. aaronjorbin commented on May 26, 2026

    @aaronjorbin
    Member

    @mirka 🤦 I absolutely read this as Icon block. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Package] UI[Status] In Progress[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions