#65089 closed enhancement (fixed)
Administration: Replace Dashicons icon font with @wordpress/icons SVG components in wp-admin
| Reported by: | lucasmdo | Owned by: | mcsf |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | needs-design needs-design-feedback has-patch has-unit-tests needs-docs needs-user-docs add-to-field-guide commit has-dev-note |
| Cc: | Focuses: | ui, accessibility, javascript, css, administration, performance |
Description
Problem / Current Behavior
The WordPress admin area (wp-admin) still relies on Dashicons, an icon font introduced in WordPress 3.8 (released December 12, 2013 — over 12 years ago). While Dashicons served WordPress well, the icon font approach has significant limitations:
- Inconsistency: The block editor and Site Editor already use
@wordpress/icons(SVG-based React components), while the rest of wp-admin uses the legacy Dashicons font. This creates a visual and technical split within the same application. - Performance: The entire icon font (~300+ glyphs) is loaded, regardless of how many icons a page actually uses. This adds unnecessary weight to every admin page load.
- Accessibility:
- Screen readers: Icons may be read as nonsense or ignored entirely, confusing users who rely on assistive technology.
- Font overrides: Users who change fonts for readability can break all icons, turning them into empty squares.
- Copy-paste: Copying text that includes icons produces random, meaningless characters.
- High-contrast mode: Icons can vanish when users enable high-contrast or forced-colors settings in their OS.
- No built-in meaning: Icon fonts are just styled characters with no inherent description — accessibility has to be added manually.5.5. No new icons can be added.
Proposed Enhancement
Replace Dashicons icon font usage in wp-admin with @wordpress/icons SVG components (or inline SVGs derived from the same library). This would:
- Unify the icon system across all of WordPress, block editor, Site Editor, and classic admin screens would all use the same modern icon library.
- Enable tree-shaking so that only the icons actually used on a given page are loaded.
- Improve accessibility: inline SVGs support
aria-labelfor example. - Allow new icons to be added as needed without growing a monolithic font file.
Rationale
This is not a new idea, it has been the stated direction of the WordPress project since 2020:
- The Make/Design blog post (April 2020) confirmed Dashicons was closed to new requests and that future efforts would focus on the new Icon component.
- 49913 explicitly states: "This update is the final planned update of the Dashicons font. Moving forward, the more modern approach of using SVG icons directly (as the block editor currently does) will be explored."
- 47498 comments reference "a long standing plan to remove all font icons from core in favor of SVGs."
Six years have passed since this direction was set, and no formal ticket tracks the actual migration work. This ticket aims to formalize the effort and track progress.
Backward Compatibility
This is a critical consideration. Many plugins and themes use dashicons-* CSS classes for admin menus, meta boxes, and custom UI. A migration plan should:
- Maintain the
dashiconsstylesheet as a deprecated fallback for a defined transition period (multiple major releases). - Provide a compatibility layer so that existing
dashicons-*class references continue to render correctly, perhaps by mapping them to their SVG equivalents. - Document the migration path for plugin and theme developers with clear timelines.
Related Tickets / References
- 49913 — Final Dashicons update (WordPress 5.5)
- 47498 — Checkbox/radio SVG migration, discusses removing font icons from Core
- 41074 — Dashicons 4.9–5.2, discusses SVG direction for the admin
- Next steps for Dashicons — Make/Design official post
- Dashicons in WordPress 5.5: The Final Update — Dev note
- @wordpress/icons package on GitHub
Attachments (1)
Change History (140)
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
5 months ago
#4
@
5 months ago
This ticket will serve as an umbrella ticket. I'll split this ticket into two: sidebar and admin bar (toolbar).
#5
@
5 months ago
Please note that we are developing public APIs to centrally manage and appropriately output SVG icons.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
5 months ago
#8
@
5 months ago
This ticket will serve as an umbrella ticket. I'll split this ticket into two: sidebar and admin bar (toolbar).
So I tried updating only the admin bar, but it looks jarring/unbalanced with the sidebar if it still shows the old dashicons. So I took a stab on implementing it for both admin bar and sidebar. I'll link the PR below.
This ticket was mentioned in PR #12270 on WordPress/wordpress-develop by @fushar.
5 months ago
#9
- Keywords has-patch has-unit-tests added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/65089
[!WARNING]
This PR is stacked on top of #12010. Please only review my commit: 6ec651a52b
Also, some icons were not already public, so they need to be made public, maybe as separate Gutenberg PR. See related: https://github.com/WordPress/gutenberg/pull/79102.
This PR replaces the dashicons usage in admin bar and menu (sidebar) with @wordpress/icons, via the newly-introduced wp_get_icon() function, which outputs an inline SVG to be rendered.
## New icon mapping
### Admin bar
| Item | Old dashicon | New wp/icons | Public? |
|---|---|---|---|
| WordPress logo | dashicons-wordpress | core/wordpress | |
| Sidebar menu toggle (mobile) | dashicons-menu-alt | core/menu | |
| My Sites | dashicons-admin-multisite | core/grid | ❌ |
| Site Name — frontend | dashicons-dashboard | core/dashboard | |
| Site Name — wp-admin | dashicons-admin-home | core/home | |
| Edit Site<br>Customize | dashicons-admin-appearance<br>dashicons-admin-customizer | core/brush | ❌ |
| Edit (post/page/etc.) | dashicons-edit | core/pencil | |
| + New | dashicons-plus | core/plus | |
| Comments | dashicons-admin-comments | core/comment | |
| Updates | dashicons-update | core/update | |
| Search<br>Command Palette | dashicons-search | core/search | |
| My Account (no-avatar fallback) | dashicons-admin-users | core/people |
### Admin menu (left sidebar)
For simplicity, only showing new items not present in the admin bar above.
| Menu item | Old dashicon | New wp/icons | Public? |
|---|---|---|---|
| Dashboard | dashicons-dashboard | core/dashboard | |
| Posts | dashicons-admin-post | core/post | ❌ |
| Media | dashicons-admin-media | core/media | ❌ |
| Links | dashicons-admin-links | core/link | ❌ |
| Pages | dashicons-admin-page | core/page | ❌ |
| Plugins | dashicons-admin-plugins | core/plugins | ❌ |
| Users | dashicons-admin-users | core/people | |
| Tools | dashicons-admin-tools | core/tool | ❌ |
| Settings | dashicons-admin-settings | core/settings | |
| Collapse menu button | dashicons-admin-collapse | core/chevron-left |
## Open questions
- I'm not sure about
My Sitesicon. The closest thing that I think fits is thecore/gridicon (see screenshot below). Open to alternatives. - The search/magnifier icon is facing the opposite direction from the old dashicon. Should we do something about it? My vote is to do nothing; if we want to reverse the direction, we should update the icon instead.
## Screenshots
### WP Admin
| Before | After |
|---|---|
| | |
### WP Admin - Multisite
| Before | After |
|---|---|
| | |
### Frontend
Before
After
### Mobile
Before
After
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: code generation, with my supervision.
@JeffPaul commented on PR #12270:
5 months ago
#10
These all appear to be solid like-for-like replacements, though I feel least supportive of the Sites icon replacement on multisite. Perhaps a new icon could/should be generated there or review other icons for something besides a 2x2 table sort of icon? Of the existing icons, the one that feels like what I'd recommend otherwise is one that looks like a "two child node branched to the right" (_sorry GitHub is giving me problems trying to upload a screenshot from my cell connection_).
@fushar commented on PR #12270:
5 months ago
#11
@jeffpaul Thanks for checking!
I feel least supportive of the Sites icon replacement on multisite.
Yep, as noted in the PR description, I'm not sure about this as well.
Of the existing icons, the one that feels like what I'd recommend otherwise is one that looks like a "two child node branched to the right"
You mean core/blockMeta? Indeed this looks more fitting. 😄
But my worry is that the icon slug is not related to "site" at all. I would expect there is something like core/sites icon. Perhaps it's better if we create a new such icon. cc: @jasmussen, @lucasmendes-design (I know you're all on vacation, feel free to respond when you're back.)
Another idea is to use this icon, to represent a "site switcher":
@tyxla commented on PR #12270:
5 months ago
#12
A few things from my end as I'm looking at this work:
- This is exciting and a much-awaited overhaul of icons, love it!
- It has the potential to have an impact on many plugins, plugin infrastructures and products that rely on the current icon set - something to be mindful about
- I don't see enough feedback from @WordPress/gutenberg-design on this, and I believe this is a hard requirement
- I believe it's a bit late in the 7.1 cycle for this to move forward, but it makes sense to get it to the finish line on time for landing early in the 7.2 cycle. It's paramount to give plugins and extenders enough time for testing and adopting the necessary changes.
- An angle that doesn't seem explored is trying this out as a Gutenberg experiment - not only to allow for safe iteration, but also as yet another way to get useful feedback.
@JeffPaul commented on PR #12270:
5 months ago
#13
@fushar yes the blockMeta was the icon I was trying to reference, though I'm not quite as concerned with the slug for it (not certain that the slug is referenced or rendered anywhere in the UI and if not then there's no end user confusion that could happen). I'm not much in favor of the chevronUpDown option for Sites, in that case would just stick with the 2x2 table-looking icon I suppose but in any case would like a better one for that icon if possible (and if as @tyxla notes this is too late for 7.1 then we've got some time to iterate on the Sites icon).
@fushar commented on PR #12270:
4 months ago
#14
An angle that doesn't seem explored is trying this out as a Gutenberg experiment
Thanks for the suggestion. I spent a good chunk of my day today trying to make this as a Gutenberg experiment.
With the help of Claude, I (we) came up with this PR: https://github.com/WordPress/gutenberg/pull/79588. Now, I understand that the changes are complicated, but I can't simplify it any further. Reasons:
- I need to render the icons that are not yet public.
wp_get_icon()won't allow me to render such icons, so I need to replicate the implementation for now. - There's no way to hook into admin menu icon. Basically I really need this new logic in Core, which can't be extended via hooks. Hence the experiment needs to hijack the output of the admin menu HTML and replace dashicons with SVG before it gets rendered.
- The CSS needs to duplicate the admin color scheme to achieve hover effect in the admin bar. In this Core change, I can just update the
_admin.scssdirectly, which can't be replicated in experiments.
Am I approaching this correctly? Or do you have better idea for a cleaner approach? Thanks!
@fcoveram commented on PR #12270:
4 months ago
#15
It looks great ✨ I noticed a few things that I'm not fully sure belong to the PR scope.
### Icon size
In most cases, the icon size is 22px, but the W symbol is 24px.
| 22px | 24px |
|---|---|
| | |
Not sure if this is intentional or not.
### Color on the frontend
On the frontend, the color at 0.6 looks slightly lighter. I know it is consistent, but at 0.85 looks visually more similar to the current. This is not a blocker but sharing it for thoughts.
### "Sites" icon
Regarding the icon for Sites, I agree that blockMeta works well until having a dedicated icon.
---
I've been testing it on Arc, Chrome, and Safari and on multiple viewports. And they all look good ⭐
@tyxla commented on PR #12270:
4 months ago
#16
Am I approaching this correctly? Or do you have better idea for a cleaner approach?
Hmm, this seems correct to me. There are side ways for achieving some of the things you mentioned, but not for others, unless we want to be super hacky. A bummer that this part of the menu is not as extensible as usual. Thank you for trying, though.
Another way to get more attention on this would be to post a call for testing on the https://make.wordpress.org/core blog.
@mcsf commented on PR #12270:
4 months ago
#17
Am I approaching this correctly? Or do you have better idea for a cleaner approach? Thanks!
I'd say so, at least for the purposes of a Gutenberg experiment. I left a comment or two in that PR.
@fushar commented on PR #12270:
4 months ago
#18
@fushar commented on PR #12270:
4 months ago
#19
@fcoveram: Thanks for the thorough testing!
In most cases, the icon size is 22px, but the W symbol is 24px.
Not sure if this is intentional or not.
Yeah, it is intentional. I'm not sure if it's the best way though. It's to achieve the same look and feel with the existing W dashicon. See the above image comparison, pasted here again:
Right now, if we use 22px, then the W logo is too small, because there's outer gap in the SVG. Maybe we need to fill the entire SVG box without any outer gap.
On the frontend, the color at 0.6 looks slightly lighter. I know it is consistent, but at 0.85 looks visually more similar to the current.
Yeah agree that 0.85 looks better. But I'm not sure if we can just update it only for the SVG icon. It's part of the Fresh color scheme; maybe we should do a separate PR to update the scheme 😄
@fushar commented on PR #12270:
4 months ago
#20
All right everyone, thanks for taking a look. I want to summarize where we're at with this PR:
- To use currently non-public icons, we need the
public: falseflag as discussed in https://github.com/WordPress/gutenberg/pull/79451#issuecomment-4797981729.- @t-hamano, is this something that you're currently pursuing? How confident are we with the solution?
- This PR adds support to use registered icons in left sidebar menu items. See this diff. To move forward, I need a review on this as it's modifying a public hook (
admin_menu).- Also, maybe we should at least ship this part first in 7.1 so that plugins can start using it?
- If we do that, it will be beneficial to ship the CSS changes for rending SVG icons in admin bar / menu.
- We need to iterate on My Sites icon. I can ask for help for this. @jasmussen / @lucasmendes-design should be interested.
- As suggested, we should publish a public Make post as a heads-up to the community and plugin developers. In the post, we should suggest the default (core) icon set for the admin, and how plugins can use SVG icons in the admin menu (the public API change I mentioned above).
It feels like there's interest to push at least some parts of it in 7.1, and we're not that sure if we can achieve everything by 7.1. @t-hamano, what's your opinion on this? It seems you have the most context for all this icon API discussion 😄
cc: @tyxla, @mcsf, @scruffian.
@wildworks commented on PR #12270:
4 months ago
#21
It feels like there's interest to push at least some parts of it in 7.1, and we're not that sure if we can achieve everything by 7.1. @t-hamano, what's your opinion on this? It seems you have the most context for all this icon API discussion 😄
Leveraging the icon API for the dashboard icons is a great idea, and introducing a public:false flag shouldn't be difficult. However, I noticed that core icons might be unregistered by consumers.
add_action( 'init', function () { wp_unregister_icon_collection( 'core' ); }, 20 );
add_action( 'init', function () { wp_unregister_icon( 'core/info' ); }, 20 );
In this case, what happens to the core menu icons registered by the icon API? This is my biggest concern. Here are the ideas I can come up with at the moment:
- Allow file paths for
menu_icon. This ensures that icons are rendered even if they are unregistered from the icon registry, as the file itself will still exist within the core. - Allow SVG strings for menu_icon. This might be a larger undertaking, requiring a proper SVG processing pipeline.
- Introduce a "built-in" collection to house icons used in dashboards and protect the unregisteredion of this collection or its icons would enhance robustness.
Do you have any other ideas?
@fushar commented on PR #12270:
4 months ago
#22
Thanks for taking a look.
I noticed that core icons might be unregistered by consumers.
Hmm interesting question. I would say, the last option (consider core/* as built-in icon set which can't be unregistered) looks the most sensible to me. It's like having a fixed set of dashicons-* slugs that consumers can always use currently.
Otherwise, we will also need another way to get the SVG string for the admin bar icons as well, because in this PR I also use wp_get_icon() to prepend the icon to the title 🤔
@mcsf commented on PR #12270:
4 months ago
#23
However, I noticed that core icons might be unregistered by consumers.
This is a good point.
- Allow file paths for
menu_icon. This ensures that icons are rendered even if they are unregistered from the icon registry, as the file itself will still exist within the core.
One of the problems here is that it makes it more difficult to iterate on icon designs in Gutenberg, since those icons will no longer override those in wp-includes.
It also may or may not add some work for certain WP installations that rely on CDNs for core assets...? This is unfamiliar territory for me.
- Allow SVG strings for menu_icon. This might be a larger undertaking, requiring a proper SVG processing pipeline.
Sounds risky and heavy-handed, as you point out yourself.
- Introduce a "built-in" collection to house icons used in dashboards and protect the unregisteredion of this collection or its icons would enhance robustness.
Maybe, but it could make things frustrating for certain admins. For example, if — say, for editorial purposes — they'd like to keep a very narrow set of available icons for the Icon block. I don't think it's unheard of to prevent deregistering a core provision, but we almost always allow it (e.g. wp_deregister_script, unregister_block_type...). (Side note: we can always explore a separate mechanism for the Icon block so that third parties can filter its list of available icons.)
There's a fourth option, loosely in response to the one above:
Allowing core icons (and core collection) to be deregistered, so that they will not show up in listings, but embedding a fallback somewhere (WP_Icons_Registry::get_registered_icon? wp_get_icon?) so that certain core icons will still render.
I don't exactly like the idea, but I thought I'd share it anyway.
Another option is to honour admins' decision to deregister things, and have a fallback "no-icon" icon. In other words, make admins and extenders responsible for the questionable decision to deregister core icons: they can do it, but the admin will look weird with placeholder icons.
@wildworks commented on PR #12270:
4 months ago
#24
Another option is to honour admins' decision to deregister things, and have a fallback "no-icon" icon. In other words, make admins and extenders responsible for the questionable decision to deregister core icons: they can do it, but the admin will look weird with placeholder icons.
Is it possible to extend this idea further and display the relevant dashicon as a fallback if the SVG icon is not registered?
@keoshi commented on PR #12270:
4 months ago
#25
One point to add to @fcoveram comment here:
In most cases, the icon size is 22px, but the W symbol is 24px.
All @wordpress/icons icons were designed with a 24×24px area in mind and all/most are optimized to be visualized at that size. Certainly in non-retina displays. Not sure if a deal breaker or not, so pinging @jasmussen to get your thoughts.
@tyxla commented on PR #12270:
4 months ago
#26
Hmm interesting question. I would say, the last option (consider
core/*as built-in icon set which can't be unregistered) looks the most sensible to me. It's like having a fixed set ofdashicons-*slugs that consumers can always use currently.
This might make sense since this is how post types work - you can't unregister_post_type() a built-in post type. But for that to work, post types also maintain a _builtin flag.
@tyxla commented on PR #12270:
4 months ago
#27
A high-level flag from me: the fact that we are still asking and answering fundamental API/design questions (registration/unregistration/compatibility) less than a couple of weeks before beta is a clear sign that a feature might need more time to get feature-complete, thoroughly thought out, and polished enough for a WordPress release. For some of that work, we might want to get broader feedback through a Make post, too, and that, on its own, will require some time to get meaningful feedback.
@Joen commented on PR #12270:
4 months ago
#28
Noting that I designed a "Sites" icon here: https://github.com/WordPress/gutenberg/pull/80094
@mcsf commented on PR #12270:
4 months ago
#29
Is it possible to extend this idea further and display the relevant dashicon as a fallback if the SVG icon is not registered?
I think this would defeat the purpose of introducing SVG icons to finally move away from Dashicons! Then we'd have to support both systems forever.
I like Marin's argument below. Currently it seems like the wisest choice to me:
This might make sense since this is how post types work - you can't
unregister_post_type()a built-in post type. But for that to work, post types also maintain a_builtinflag. Seems like this is yet another "flag" to consider for icons.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
3 months ago
@Joen commented on PR #12270:
2 months ago
#31
Coming back to this one, the Verse icon is growing on me for posts. I also tried the cog for settings, the single image for media, the single page for pages, and in https://github.com/WordPress/gutenberg/issues/81274 I tried a new "tool" icon that could eventually benefit this effort.
#32
@
2 months ago
Noting that I created https://make.wordpress.org/core/2026/09/04/replacing-dashicons-in-the-admin-bar-and-menu/ to help bring more visibility to this issue.
@fushar commented on PR #12270:
2 months ago
#33
All right, after the dust settled for 7.1, I rebased updated the PR as follows:
- Use default 24px size for the icons
- Use the new
core/sitesfor My Sites. - Use
core/versefor Posts. - Use
core/cogfor Settings.
I updated the screenshots in this PR to reflect the latest.
We still need to decide how to use the currently-private icons; it's still unresolved discussion.
@fushar commented on PR #12270:
2 months ago
#34
@Joen commented on PR #12270:
2 months ago
#35
Not a strong opinion, but I don't think this should be a Gutenberg experiment. It seems worth merging early in the cycle, and then evaluating feedback from that.
@afercia commented on PR #12270:
2 months ago
#36
When running npm install on this branch, it hangs for minutes for me with this message. Is it just me?
npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. npm notice This endpoint is being retired. Use the bulk advisory endpoint instead. See the following docs for more info: https://api-docs.npmjs.com/#tag/Audit
@ugyensupport commented on PR #12270:
2 months ago
#37
Tested locally against a WP 7.1 (trunk-level) install, both commits applied.
The PR's code works correctly against core alone — verified via wp eval that wp_get_icon('core/tool') and the other 11 new icons all return proper SVG markup, and confirmed visually (WP logo, Media, Pages, Appearance, Plugins, Tools, Settings all render the new inline SVGs correctly in the admin bar and sidebar, desktop and mobile breakpoints). The core/people no-avatar fallback and the mirrored search icon also behave as described in the PR.
Heads-up for anyone else testing locally with the Gutenberg plugin active, though: Gutenberg ships its own WP_Icons_Registry_Gutenberg shim (lib/class-wp-icons-registry-gutenberg.php) that replaces core's WP_Icons_Registry singleton with a registry pre-loaded from Gutenberg's own (currently stale) icon set. Core's _wp_register_default_icons() still runs, but registration of this PR's 12 new icons silently no-ops via _doing_it_wrong( 'WP_Icons_Registry_Gutenberg::register', 'Icon is already registered.' ) wherever the name collides with something Gutenberg already claimed under core/*. Net effect with Gutenberg active: wp_get_icon() returns '' for all 12 new icons, so the WP logo/Media/Pages/Appearance/Settings icons all render blank, and the sidebar's <img> fallback path (wp-admin/menu-header.php) additionally throws a console error per item (net::ERR_NAME_NOT_RESOLVED @ http://core/tool, etc., since esc_url('core/tool') resolves as a protocol-relative host).
This isn't a bug in the PR — deactivating Gutenberg makes every icon render correctly immediately — but since most contributors run Gutenberg locally, it's easy to mistake for one. Worth a note somewhere (or something Gutenberg's own compat shim will need to catch up on before/when this lands).
Screenshots (before / after / after-with-Gutenberg-active-showing-the-blank-icons) and full write-up: available on request, not attached here to keep this comment focused.
🤖 Generated with Claude Code
@afercia commented on PR #12270:
2 months ago
#38
A note on the wp_get_icon() function: the handling of the focusable="false" can be entirely removed. That attribute was originally introduced as a workaround for an Internet Explorer bug. IE made any SVG icon within a link focusable so there were two tab stops when tabbing through linked buttons that contained an icon.
Given IE is no longer supported, as far as I can tell the focusable="false" attrirbute is no longer necessary.
Cc @joedolson
@ugyensupport commented on PR #12270:
2 months ago
#39
Before/after screenshots from the local testing above (Gutenberg deactivated, so the PR's icons render as intended):
🤖 Generated with Claude Code
#40
follow-up:
↓ 41
@
2 months ago
Great idea, and I'm already looking forward to seeing it implemented. As a plugin developer, I use Dashicons a lot, of course. So I would appreciate it if you could implement
Provide a compatibility layer so that existing dashicons-* class references continue to render correctly, perhaps by mapping them to their SVG equivalents.
and also include instructions on how to use the new icons in CSS instead of the old ones.
Looking forward to hearing more about this :)
#41
in reply to: ↑ 40
@
2 months ago
Replying to threadi:
As a plugin developer, I use Dashicons a lot, of course. So I would appreciate it if you could implement
Provide a compatibility layer so that existing dashicons-* class references continue to render correctly, perhaps by mapping them to their SVG equivalents.
Howdy! The idea is that this is backwards-compatible; so the existing dashicons-* will still work and render the original Dashicons as-is (without any mapping). Hope this helps!
#42
@
2 months ago
include instructions on how to use the new icons in CSS instead of the old ones.
Good question. The recommended path would be to call wp_get_icon():
echo wp_get_icon( 'core/category', array( 'label' => __( 'Categories', 'my-plugin' ), ) );
This outputs the icon inline. You can find see the full set, with names, here. That page also shows which icons are currently public, which are the ones available to insert at the moment, but more are being made public.
A pure CSS method is not something I've dug deep into quite yet, but after the PR lands, some options should be possible. Something like:
.my-plugin-thing::before {
content: "";
display: block;
width: 24px;
height: 24px;
background-color: currentColor;
-webkit-mask: url(/wp-includes/images/icon-library/category.svg) center / contain no-repeat;
mask: url(/wp-includes/images/icon-library/category.svg) center / contain no-repeat;
}
That could get into CORS trouble and fail across domains. An extreme way that should be theoretically possible but probably avoided would be something along these lines:
add_action( 'admin_enqueue_scripts', function () {
$icons = array( 'category', 'cog' ); // only what you actually use
$props = '';
foreach ( $icons as $name ) {
$file = ABSPATH . "wp-includes/images/icon-library/{$name}.svg";
if ( ! is_readable( $file ) ) {
continue;
}
$svg = preg_replace( '/\s+/', ' ', trim( file_get_contents( $file ) ) );
$uri = 'data:image/svg+xml,' . strtr(
rawurlencode( $svg ),
array( '%20' => ' ', '%3D' => '=', '%3A' => ':', '%2F' => '/' )
);
$props .= "--wp-icon-{$name}:url(\"{$uri}\");";
}
wp_add_inline_style( 'my-plugin-admin', ":root{{$props}}" );
} );
That could theoretically, but this unverified on my part, let you do something like this:
.my-plugin-icon {
display: inline-block;
width: 24px;
height: 24px;
background-color: currentColor;
-webkit-mask: var(--wp-icon-category) center / contain no-repeat;
mask: var(--wp-icon-category) center / contain no-repeat;
}
I would note all of this is me tinkering with PHP and CSS. I'm not recommending using it this way, and it should not be the official way to do it. Hope that helps.
#43
@
2 months ago
Overall I like this direction. One nit is that the new "brush" icon is difficult to distinguish as the Appearance icon. I feel the "styles" (half filled circle) may be a better fit.
#44
@
2 months ago
I would agree with @awetz583 that the brush is difficult to distinguish for the Appearance menu item... I would personally opt for desktop (laptop) icon, since it's not just Styles, but also the Editor and Fonts.
That said, everything looks really sharp, great improvements 👏
@Joen commented on PR #12270:
2 months ago
#45
Noting that I'm responding here to some feedback on the core post, just to consolidate it all in one place. I will follow up and link to this comment from the comments.
The feedback fell in two categories:
- which icon to best use for their dashicon counterparts
- optical balance: some being bigger, some being smaller.
For this PR I think we should update the icons to what agreement is found as far as which icons to use, pin vs. verse, etc. As for the actual optical balance changes, upon agreement I will make a PR to the componentry source and we can then follow up shortly after with a new PR here. It's important to know the context and the followup, even if we do it in two phases.
I tried to address as much as possible in the mockup below:
| Set | Mockup |
|---|
- Testing a new larger "brush" icon, closer to its original sibling counterpart.
- Gallery icon instead of "image" for Media.
- New optically balanced Pin icon for Posts
- New optically balanced comment icon for comments.
- Visually updated Tools icon, stroke based
- Updated Settings icon
I personally think this one gets us closer as far as balance, though @mrwweb makes a good point that is notably visible in the bottom group of icons:
The icons themselves feel like what they are—an assemblage of icons designed for different purposes through the WP UI
There's an aspect of the icons having organically built up separately, as also tracked here. As part of the effort to convert to stroke-based, however, small improvements have been made to a number of icons specifically to address the points raised there, and extending that set for this collection of main admin icons feels valid. For me what stands out is that there are many diagonal icons in the utility section that causes a bit of a mix. Here's an attempt at addressing this head on:
| Set | Mockup |
|---|
- The Plugins icon is now adjusted, polished, and tipped 45 degrees.
- There's a new "Media" icon, that's closer to the source material.
The rework of the plugins icon makes it immediately feel like it belongs next to tools and appearance.
I'm not too sure about the new Media icon: I honestly prefer using something simpler like just a single "image" icon. But there is some value in recognition that's worth acknowledging.
---
In defence of the "Verse": the following I want to acknowledge as good feedback:
re: the posts icon – I think the iconography is too similar to the updated appearance icon. And while the Verse block certainly isn’t an everyday block for most sites, it feels odd to reuse it for the original post type. I didn’t do a full audit, but I wonder about other icon purposes overlapping that might create confusion, even if infrequently.
Perhaps with a larger brush, the Verse icon can be reintroduced as it no longer looks similar. Nevertheless, the post type point is worth noting. I think of this as the quill pen icon, that happens to be used for the Verse block, and thus the connection between block and type didn't occur to me.
WordPress may be the last bastion of the open web. Its users write, without arbitrary limitation from closed platforms, never locked in. There's some beauty to that which feels like poetry. So for me using the quill pen icon is more a matter of bringing that character into WordPress—code is poetry, after all.
In the process of redrawing icons to be stroke-based, I also tried some stress tests to validate the point of stroke-based, namely that you can contextually set the weight:
It's likely not a UI we'll use anywhere—or could it become part of a mobile effort? In any case, next to "Page", the quill pen just looks beautiful to me.
In any case, I'll be delighted for WordPress to get fresh energy on the icon side. For now, the main action item on these mockups is to agree on: which icons should we use? If we find agreement on those, I will follow up on the icon design changes based on that agreement and we can make a new PR. Is that fair?
---
To note, a suggestion was to use the "styles" icon for the Apperance section. I tried that below, and I think it could work if also replacing some of the other utility icons.
<details><summary>View</summary>
</details>
@mrwweb commented on PR #12270:
2 months ago
#46
@jasmussen These changes all feel both very responsive to the overall feedback and like really meaningful improvements!
The plugins icon feels especially better cleaned up and tilted 45 degrees! I like the direction of the new Media Library icon, though there's something about the music notes that is maybe slightly too heavy. (That's a super nit pick, and it feels much more cohesive than the old one). I also like the settings icon change that was suggested. Really nice work!
I like your points in defense of the quill icon, writing, and the open web. I think there's something there. The new distinctive paintbrush icon solves what felt like the bigger of the two issues with the quill not being distinctive enough. Personally, I've never loved the pin icon either, so I like your idea of a change for Posts.
I haven't thought about this deeply, but I wonder if a fountain pen icon could potentially have the same meaning without any risk of ambiguity? (Pencil is presumably still reserved for editing.) Here's a noun project icon purely as a directional composition idea that could use a 45 degree angle.
@JeffPaul commented on PR #12270:
2 months ago
#47
In any case, next to "Page", the quill pen just looks beautiful to me.
In any case, I'll be delighted for WordPress to get fresh energy on the icon side.
Totally agree, beautiful!
@fushar How does the before/after look for an RTL site?
@Joen commented on PR #12270:
2 months ago
#48
Thank you all for the feedback. Noting that for now I've updated the "after" image (including a tiny slipstreamed tweak to make the musical note in "media" ever so slightly smaller) on the general make/core post.
In general I pledge to follow up on any details that emerge from conversation in followups—the fountain pen idea is a good one—though perhaps before I go much deeper it's better to give additional feedback a chance to land, and for Ashar to update this PR with the latest choices. I will then separately start to prep the new icons for inclusion in the library. Sound good?
#49
@
2 months ago
- Keywords needs-docs needs-user-docs needs-dev-note add-to-field-guide added
We'll need to document this change (with both a dev note, and also end user docs) and update a good amount of existing docs (screenshots… ugh 😅).
Therefore I'm adding some useful keywords to the ticket :)
@fushar commented on PR #12270:
2 months ago
#50
@fushar commented on PR #12270:
2 months ago
#51
and for Ashar to update this PR with the latest choices.
@jasmussen I updated this PR (and the screenshots) with core/pin for Posts, and core/settings for Settings!
I'll try to revive the Gutenberg PRs which are necessary to get the non-public icons in for this PR.
@Joen commented on PR #12270:
2 months ago
#52
Thanks. I will also follow up ASAP on the new and adjusted icons shown in this thread.
@fushar commented on PR #12270:
2 months ago
#53
For anyone following along, the latest state of the PR can be tested using this special Playground link: https://playground.wordpress.net/?core-pr=12270&gutenberg-pr=79451 🙂
@ugyensupport commented on PR #12270:
2 months ago
#54
Re-tested this via the Playground link in the description (core PR + Gutenberg PR 79451), since core alone can't render this without the icon backport.
Verified working:
- Sidebar icons (Dashboard, Posts, Media, Pages, Comments, Appearance, Plugins, Users, Tools, Settings, Collapse) render as real inline
<svg>, not broken/missing glyphs — confirmed via DOM inspection, not just visually. - Admin bar icons (WP logo, Site Name/home, Menu toggle, Search, +New, Comments) render with the correct icon per item.
- Hover/current-item highlighting still recolors the SVG (
fill: currentColor+ hover rules). - Folded/collapsed sidebar mode renders correctly, icon-only.
- No console errors or 404s tied to icons;
dashicons.cssstill loads fine as a residual dependency for the parts not yet converted.
One thing I suspected from reading the diff but disproved by testing: the CSS deletes several #wpadminbar #wp-admin-bar-<item> > .ab-item::before { width: 52px; height: 46px; ... } mobile (≤782px) rules with no obvious SVG replacement, which looked like a mobile-icon-sizing regression on first read. Checking computed styles at a 375px viewport showed it's fine — a pre-existing generic rule (#wpadminbar .ab-icon, #wpadminbar .ab-icon.svg-icon { width: 52px; height: 46px; ... }) already covers the new .ab-icon elements, so the deleted per-ID rules were dead code once the icon moved from ::before onto a real element. No action needed.
Suggestions (non-blocking):
- Dead CSS in the mobile media query:
admin-bar.cssstill appliesfont: 40px/1 dashicons !important;to the new.ab-icon.svg-iconselector even though SVG sizing is fully controlled by the separatesvg { width/height }rule added right after it. Harmless, but worth trimming for clarity. - Redundant
aria-hidden:_wp_admin_bar_icon(), the collapse-button span, and the.wp-menu-imagewrapper inmenu-header.phpall setaria-hidden="true"on the wrapper *and*wp_get_icon()already sets it on the inner<svg>by default. Not wrong, just duplicate. - Not exercised in this pass: RTL layout, multisite/network-admin sidebar, and the "has site icon" branch of the admin bar (my test site had no site icon and wasn't multisite). Worth a manual pass on those before merge.
Traced the icon-selection logic (menu.php's $builtin/WP_Icons_Registry::is_registered() branch, wp_admin_bar_site_menu()'s home-vs-dashboard choice, the dashicons-/data:image/svg+xml/registered-icon fallback chain in _wp_menu_output()) against the PR's before/after table and it's consistent — no logic bugs found. PHPUnit/QUnit fixture updates correctly match the new icon slugs.
Nice work overall — only minor cleanup opportunities, nothing blocking.
@fushar commented on PR #12270:
2 months ago
#55
Something is not right, it seems the above Playground link is not serving the latest state of this PR (the Posts sidebar is showing blank instead of pin). Let me think...
@wildworks commented on PR #12270:
8 weeks ago
#56
@fushar, thank you for working on this, and I apologize for the delayed reply.
The biggest concern with moving this PR forward is that the core icon collection could be unregistered by consumers. If a consumer were to use code like the following—for example, to hide core icons in the Icon block—all the dashboard menu icons would disappear. I don't think the dashboard icon should disappear under any circumstances.
add_action( 'init', function () { wp_unregister_icon_collection( 'core' ); }, 20 );
Perhaps we should add a non-deletable _builtin icon collection, and any icons related to the dashboard should be included in that collection. This idea has already been proposed in https://github.com/WordPress/wordpress-develop/pull/12270#issuecomment-4864984947. This approach is similar to how post types and post taxonomies are handled.
@ugyensupport commented on PR #12270:
8 weeks ago
#57
@t-hamano I re-tested this against the Playground link in the PR description (core PR #12270 + gutenberg#79451) and can confirm the concern — it's a clean, one-line reproduction:
add_action( 'init', function () { wp_unregister_icon_collection( 'core' ); }, 20 );
Before: wp_get_icon( 'core/pin' ) returns valid SVG, 99 icons registered under the core collection.
After the snippet runs: wp_get_icon( 'core/pin' ) returns '', 0 collections and 0 icons remain registered. Every admin-bar and sidebar icon disappears on /wp-admin/ — WP logo, +New, Comments, avatar, Dashboard, Posts, Media, Pages, Comments, Appearance, Plugins, Users, Tools, Settings, all gone. Removing the mu-plugin restores them immediately, confirming it's the unregister call.
Root cause is in the already-merged registry classes, not in this diff: WP_Icon_Collections_Registry::unregister() (class-wp-icon-collections-registry.php) and WP_Icons_Registry::unregister() (class-wp-icons-registry.php) have no protection for the core collection/icons, and this PR is what makes core chrome newly depend on that same collection.
+1 on the _builtin approach from #12270 (comment), mirrored on `unregister_post_type()`. Concretely, in icons.php/class-wp-icon-collections-registry.php/class-wp-icons-registry.php:
- Mark the
corecollection_builtin => truewhen_wp_register_default_icon_collections()registers it — but keep that flag internal (not part of the publiclabel/description$allowed_keysinWP_Icon_Collections_Registry::register()), so a plugin can't declare its *own* collection built-in and make it un-removable too. - Guard both
unregister()methods:// WP_Icon_Collections_Registry::unregister() if ( ! empty( $this->registered_collections[ $collection_slug ]['_builtin'] ) ) { _doing_it_wrong( __METHOD__, __( 'Unregistering a built-in icon collection is not allowed.' ), '7.1.0' ); return false; }
// WP_Icons_Registry::unregister() $collection = WP_Icon_Collections_Registry::get_instance()->get_registered( $this->registered_icons[ $icon_name ]['collection'] ); if ( ! empty( $collection['_builtin'] ) ) { _doing_it_wrong( __METHOD__, __( 'Unregistering a built-in icon is not allowed.' ), '7.1.0' ); return false; }
The second guard matters on its own — without it a consumer can still pick off individual
core/*icons one at a time viawp_unregister_icon()even with the collection protected.
- Add coverage in
tests/phpunit/tests/icons/wpIconCollectionsRegistry.phpandwpIconsRegistry.phpasserting both unregister calls returnfalseand leave the registry untouched forcore, plus a case that a plugin can't smuggle_builtin => trueonto its own collection.
Since the registry classes are already in trunk, this would need its own small companion PR/ticket rather than living in this diff — happy to help put that together if useful. Screenshots of the before/after repro available if helpful.
@ugyensupport commented on PR #12270:
8 weeks ago
#58
Screenshots from a repro of the above, on the Playground link in the PR description (core PR #12270 + gutenberg#79451):
Before — normal dashboard, all icons render:
After — same site, after an mu-plugin runs the exact snippet quoted above (wp_unregister_icon_collection('core') on init, priority 20). Every admin-bar and sidebar icon disappears — WP logo, +New, Comments, avatar, and the entire left menu:
Removing the mu-plugin restores them immediately, confirming it's the unregister call.
@mrwweb commented on PR #12270:
8 weeks ago
#59
Does preventing unregistering the icon in the admin also prevent unregistering the Core icon set in the Icon Block? If so, I think that would be a problem for a lot of customized sites.
Glancing at the snippets above would seem to suggest it applies to all contexts. Sorry that I don't have time to test this right now, but I just want to make sure. It'll still be important that developers can provide and limit icons in the Icon block to a single custom set that does not include the Core set.
@wildworks commented on PR #12270:
7 weeks ago
#60
I have submitted https://github.com/WordPress/gutenberg/pull/83012, which proposes adding a built-in icon set that cannot be unregistered internally, separate from the core icon collection.
@mcsf commented on PR #12270:
7 weeks ago
#61
@dugyen: let's avoid the LLM replies, please. See our emerging AI guidelines. Honest contributions from a human are welcome, especially in the form of proper testing, use-case feedback, and novel suggestions; everything else is verbiage and a distraction.
@fushar commented on PR #12270:
7 weeks ago
#62
The biggest concern with moving this PR forward is that the core icon collection could be unregistered by consumers. If a consumer were to use code like the following—for example, to hide core icons in the Icon block—all the dashboard menu icons would disappear. I don't think the dashboard icon should disappear under any circumstances.
Perhaps we should add a non-deletable _builtin icon collection, and any icons related to the dashboard should be included in that collection. This idea has already been proposed in https://github.com/WordPress/wordpress-develop/pull/12270#issuecomment-4864984947. This approach is similar to how post types and post taxonomies are handled.
Thanks @t-hamano and sorry for the delayed response as I am supposed to be on vacation this week 😄 Somehow, I missed this discussion as it was long time ago 🤦
I have submitted WordPress/gutenberg#83012, which proposes adding a built-in icon set that cannot be unregistered internally, separate from the core icon collection.
It's an interesting approach. However, it seems to exclusively works with core (WordPress) icons. I think your concerns can also be applied to plugins. For example, what if e.g. Font Awesome also registers some public: false icons to show icons in the admin bar or menus (for its plugin itself)? Now other plugins or certain admins cannot unregister the collection without also making the icons in the admin bar or menus suddenly disappear.
I am proposing two new approaches:
- If an icon is
public: false, allow it to render viawp_get_icon()even though the collection itself is unregistered. - Or, have a separate collection for admin screens. For instance,
core-admin/, orfont-awesome-admin/. Those icons are not supposed to be offered in the Icon block, thus all icons inside them should bepublic: false. The collections can still be unregistered, but it's a questionable decision by extenders.- when doing
gutenberg_register_default_icons(), ifpublic: falsein the manifest, we also register the icon tocore-admin/.
- when doing
Thoughts?
@mcsf commented on PR #12270:
7 weeks ago
#63
It's an interesting approach. However, it seems to exclusively works with core (WordPress) icons. I think your concerns can also be applied to plugins. For example, what if e.g. Font Awesome also registers some
public: falseicons to show icons in the admin bar or menus (for its plugin itself)? Now other plugins or certain admins cannot unregister the collection without also making the icons in the admin bar or menus suddenly disappear.
I completely understand the worry here, but my intuition tells me that we should think of this as two separate concerns:
- Built-in icons are really critical, because we don't want WP-Admin standard icons to ever degrade to some kind of fallback
- Third-party menus and other pieces of plugin code may certainly consider some icons to be "critical" for them, but the hackable nature of WordPress is such that filters may have been added/removed, icons may have been edited, and so all third-party code must be somewhat defensive. Yes, it would annoying if the admin icon for Plugin X were suddenly missing, but the alternative would be to prevent other third parties from ever filtering Plugin X's data, which IMO would go against WP's spirit of extensibility. WDYT?
Also, a reminder that, whatever solution we adopt, it should not break Gutenberg's ability to override Core icons. I know, I know, this looks a bit like a double standard. 😄
@Joen commented on PR #12270:
7 weeks ago
#64
Noting, better late than never, that there's a PR here to update and add new icons based on the discussion here: https://github.com/WordPress/gutenberg/pull/83338
@fushar commented on PR #12270:
6 weeks ago
#65
I updated this PR based on the recently-merged GB PRs:
- https://github.com/WordPress/gutenberg/pull/83261
- https://github.com/WordPress/gutenberg/pull/83338
I also updated the images in the PR description to reflect the latest state. This PR can now be tested on: https://playground.wordpress.net/?core-pr=12270&gutenberg-branch=trunk 🙂
@fushar commented on PR #12270:
5 weeks ago
#66
@t-hamano / @desrosj, now that Gutenberg 24.1 is released, could you help syncing it to Core trunk, so that I can rebase this PR and (finally!) test it properly? 🥹
@fushar commented on PR #12270:
5 weeks ago
#67
I've pushed two minor changes
Thanks for the changes, those look good to me!
As I understand it, this PR depends on a couple of tasks
Ah yep, you're right, we need the backport PR as well. I forgot about that because PR also seems to work just with GB 24.1 installed as plugin with the Playground link I mentioned above. It seems that PR is already approved.
@wildworks commented on PR #12270:
4 weeks ago
#68
- Sync changes from Gutenberg 24.1: This will sync the latest icon manifest file to Core. The manifest file includes a
collectionsproperty to distinguish betweencoreandcore-admincollections. See https://github.com/WordPress/gutenberg/pull/83261/.- Commit https://github.com/WordPress/wordpress-develop/pull/13625. This will register the non-public
core-admincollection directly into Core itself.
@fushar, I've finished these tasks. We should be able to test this PR without Gutenberg once it is updated.
@fushar commented on PR #12270:
4 weeks ago
#69
Thanks @t-hamano!
I rebased and retested this PR:
- tested using multiple other plugins to check backward compatibility
- tested mobile and desktop resolutions
- tested with admin color schemes
- tested multi-site installations
Seems to working well. This PR is ready for final review I think 🙂
lucasmendes-design commented on PR #12270:
4 weeks ago
#70
I've spent some time testing the icons on many different contexts and situations. My feedback is not blocker is just an enhancement we must do in the future or if it's possible now. It's amazing to see the WP Admin with the new icons and it's already way better than before. It feels more modern and clean :)
Following up on @jasmussen's stroke weight test, I believe we have a case for it on mobile. This comment shows the problem and a small fix.
Currently, the mobile breakpoint grows the admin bar icons from 24px to 34px. However, every Core icon has vector-effect="non-scaling-stroke", so the line stays at 1.5px. The icon is 42% bigger, the stroke is not. In other words, the sidebar icons keep a 1:16 stroke to size ratio and the admin bar drops to 1:22. That is why the admin bar looks thinner than the sidebar on the same screen.
The fix is one rule inside the existing 782px media query:
#wpadminbar .ab-icon svg {
width: 32px;
height: 32px;
stroke-width: 2;
}
32px with a 2px stroke keeps the same 1:16 ratio as the sidebar and stays on the pixel grid. 34px would need 2.125px, which is not. The W logo is already 32px on mobile, so it aligns as well.
lucasmendes-design commented on PR #12270:
4 weeks ago
#71
Longer term this ratio could live in the icon API as a stroke width option, as discussed in gutenberg#81274. That is a follow-up, not this PR.
@Joen commented on PR #12270:
4 weeks ago
#72
Thanks, there's a trivial fix we can easily land in 7.2 on the icon scaling, if we have to, I'll chat with some folks.
@fushar commented on PR #12270:
4 weeks ago
#73
32px with a 2px stroke keeps the same 1:16 ratio
100c741891f1569378509e54c42de1b0391d0945 + https://github.com/WordPress/gutenberg/pull/84081 should fix it 😄
@fushar commented on PR #12270:
4 weeks ago
#74
I am keeping track of unresolved discussions. Stopping here for the day and will continue tomorrow 👍
@ugyensupport commented on PR #12270:
4 weeks ago
#75
Are we very close to merge this build @fushar @tyxla
@fushar commented on PR #12270:
4 weeks ago
#76
My main worry is backward compatibility: many plugins and sites rely on dashicons classes, ::before CSS and dashicons-* values in menu_icon, and this PR can break them without a fallback when an icon is missing.
@tyxla, you're right, I'm now playing around with plugins after scanning veloria, and many break. I'm thinking on some compromises. Please don't re-review backcompat issues as I'm still refining the ideas.
@fushar commented on PR #12270:
4 weeks ago
#77
Hi all. It seems easier to review the backcompat issues by drafting the dev note first, so we can align with the backcompat expectation.
I spent the entire day brainstorming 🙂 the tricky part here is that some admin bar nodes use <span class="ab-icon"> in the title and then use .ab-icon::before in CSS to draw the dashicons. But, some target .ab-item::before directly without additional span in the title. So, any backcompat logic must take these differences into account.
Also it seems, there will be breaking changes no matter what. It is hard to mimic existing ::before rule in CSS and apply it to the SVG, unless we want to use hacky JS. It doesn't seem wise to achieve 100% backcompat.
I've put together my idea and rationale here: https://docs.google.com/document/d/1N-Yx8nxQPpVHWZhVuiybHdhJR5D7sl45jX7sCOQ1orA/. Note that the doc is AI-assisted and I might rewrite some parts later, but trust me that I am responsible with the high-level idea and the structure of the doc 😄 Any suggestions welcome.
I pushed an implementation of the idea in the latest commit f7a6e83.
I am still testing locally with various plugins. I will continue testing on Monday. Have a good weekend.
@fushar commented on PR #12270:
4 weeks ago
#78
My own (human) reading of the situation: WordPress never guarantees the stability of DOM or CSS selectors, though historically many plugins depend on them in some way. The breakage happen on plugins that modify the admin bar, and I don't see catastrophic issues. (With the exception of the double icons on My WP Customize Admin/Frontend 1.27.4; we might want to email the plugin author out of courtesy.)
The main issue here is styling on ::before pseudo-element. I don't see a good way to achieve 100% back-compat. Example approaches:
- Printing the icons as mask in the CSS, which is against the original vision.
- Detecting such rules and recreating the rules for the correct target via JavaScript.
So if we want to move forward with this without hacky approaches above, I believe the most appropriate way forward is to polish and ship this PR, and publish the dev note soon so plugin authors can adapt asap.
@tyxla commented on PR #12270:
4 weeks ago
#79
So if we want to move forward with this without hacky approaches above, I believe the most appropriate way forward is to polish and ship this PR, and publish the dev note soon so plugin authors can adapt asap.
I agree with this. It's the only way we can move forward. So a good next step would be to have a very thorough dev note that helps people with various use cases migrate their code. We should land this sooner so it's part of the 7.2 beta and folks have a good chance to test it. I'm around this week and happy to help with whatever I can to move this forward.
@fushar commented on PR #12270:
4 weeks ago
#80
So a good next step would be to have a very thorough dev note that helps people with various use cases migrate their code.
Yes, that's what I'm trying to capture with the draft dev note 😄
I'm around this week and happy to help with whatever I can to move this forward.
Thanks, looking forward to it! Another area to help is the discussion re: performance. I'm still testing and it is a fact that this PR makes wp-admin pages load *slightly* slower, but not sure if we should implement the improvement (whatever it is) here in PR. One possible approach is maybe to hardcode (generate) the core-admin/ SVG strings so that they don't have to be read from disk and validated every time we load wp-admin pages.
@tyxla commented on PR #12270:
4 weeks ago
#81
Another area to help is the discussion re: performance. I'm still testing and it is a fact that this PR makes wp-admin pages load slightly slower, but not sure if we should implement the improvement (whatever it is) here in PR. One possible approach is maybe to hardcode (generate) the core-admin/ SVG strings so that they don't have to be read from disk and validated every time we load wp-admin pages.
Yeah, I don't think it needs to happen in this PR, but it would help to have a few possible explorations / approaches tried out so we can pick the one that is the best compromise. The performance aspect here be something that surely comes up during beta, so we do some of the legwork in draft PRs before actually merging the PR.
dugyen commented on PR #12270:
4 weeks ago
#82
@fushar, my name was unlinked could you please check
@ugyensupport commented on PR #12270:
4 weeks ago
#83
Test Report
Environment
- WordPress: 7.2-alpha (PR build via Playground)
- PHP: 7.4.33
- Browser: Chrome
- OS: macOS
- Theme: Twenty Twenty-Five
Results
Core icons
- ✅ Admin bar (wp-admin): menu, WP logo, home, search, comments and + New render as SVG with
aria-hidden="true". - ✅ Admin bar (frontend): Site Name shows the dashboard icon, Edit Site the brush, Edit Post the pencil.
- ✅ Admin menu: all core items render 24px SVGs; Collapse Menu chevron flips when collapsed and the folded menu looks correct.
- ✅ Mobile (400px): menu toggle, home, search and plus render correctly.
- ✅ RTL: layout mirrored, collapse chevron points the right way.
Back-compat with plugin icons
| Case | Result |
|---|---|
Unmapped Dashicon (dashicons-chart-pie) | ✅ still uses the font icon |
CPT with menu_icon => 'dashicons-admin-post' | ✅ mapped to the pin SVG |
base64 SVG / image URL / 'none' | ✅ unchanged |
Namespaced icon core/chart-bar (menu page, CPT, admin bar icon arg) | ✅ renders as SVG |
Admin bar node with <span class="ab-icon dashicons dashicons-star-filled"> | ✅ icon shows |
Admin bar node with .ab-icon:before { content: "\f155" } | ✅ icon shows |
Unregistered icon (core/does-not-exist) | ✅ empty slot + _doing_it_wrong notice
|
Color schemes
- ✅ In all 9 core schemes, the computed color of the SVG menu icons matches the Dashicons menu icons exactly (base and current states), and admin bar icons match too.
- ✅ A custom scheme registered with its own stylesheet and
iconscolors gets the new inline rules applied (base and current colors correct).
Notes
- Minor: an admin bar node with an unregistered icon still outputs an empty 24px
.ab-icon.svg-iconspan plus margin, leaving a visible gap before the title. The admin menu outputs nothing in the same case — skipping the wrapper whenwp_get_icon()returns an empty string might be cleaner. - The only failing check, "Upgrade from 7.1 / PHP 8.4 with MySQL 8.4 multisite", is a network timeout downloading
wordpress-7.1.tar.gz, unrelated to this PR. - Not tested: multisite (My Sites / blavatar) and the live color-scheme preview on the profile screen.
@fushar commented on PR #12270:
4 weeks ago
#84
Thanks @t-hamano for reviewing and resolving GitHub comments, I'll continue tomorrow!
@fcoveram commented on PR #12270:
4 weeks ago
#85
Chiming in with a design review. Feel free to dismiss these thoughts if this isn't timely.
Stroke width on mobile
With the stroke scaling work (Gutenberg#84081), the 32px size becomes bolder. I see that non-scaling-stroke is still there, so a follow-up would be to find a coherent way to use icons that keeps the stroke width the same in both the admin bar and the sidebar.
WordPress icon scale
The WordPress icon looks slightly bigger because it uses 20 of the 24 units in its container. Until the icon becomes stroke-based, perhaps we can scale it to 18px inside the same 24px container. This also relates to #84105.
Search icon orientation
The new search icon faces the opposite way, and SearchableSelectControl already shows it. I'd flip it horizontally to match the search icon in the Command Palette until the latter inherits the new design. This is only an interim solution so the user flow for triggering the CP doesn't feel visually clumsy.
@fushar commented on PR #12270:
4 weeks ago
#86
The WordPress icon looks slightly bigger
But isn't this also the case with Dashicons before this PR? I thought that's intended 😄 the W's circle before and after this PR has the same size I believe.
@fcoveram commented on PR #12270:
4 weeks ago
#87
But isn't this also the case with Dashicons before this PR? I thought that's intended 😄 the W's circle before and after this PR has the same size I believe.
I don't know what structure Dashicons followed, and the current SVG exceeds the grid. It is definitely a design problem, but the solution is tricky, as logos scale proportionally and the ring that wraps the W symbol does as well.
@fushar commented on PR #12270:
3 weeks ago
#88
Search icon orientation
The new search icon faces the opposite way, and SearchableSelectControl already shows it. I'd flip it horizontally to match the search icon in the Command Palette until the latter inherits the new design. This is only an interim solution so the user flow for triggering the CP doesn't feel visually clumsy.
Hmm, what about the frontend search icon (the one in top-right), do we want to flip that as well?
Also, wouldn't it be much easier and consistent if we flip the one in the command palette modal instead? Then everything will match new new search icon?
@fushar commented on PR #12270:
3 weeks ago
#89
WordPress icon scale
Until the icon becomes stroke-based
I'd defer this to @jasmussen because I read the idea is to NOT make wordpress icon stroke-based as per https://github.com/WordPress/gutenberg/issues/81274#issuecomment-5989357989.
@fushar commented on PR #12270:
3 weeks ago
#90
I made a few iterations to the draft dev note. I believe it's now in a good shape.
I ran this with my Opus 5.5 agent (which had access to a working local WordPress dev server) and it verified the claims 🙂
The next step would be to agree on the direction of the back-compat strategy mentioned in the dev note.
@fcoveram commented on PR #12270:
3 weeks ago
#91
Hmm, what about the frontend search icon (the one in top-right), do we want to flip that as well?
I don't see a reason as the input visible after clicking on the icon shows the same orientation.
Also, wouldn't it be much easier and consistent if we flip the one in the command palette modal instead? Then everything will match new new search icon?
Not sure if it's easier, but coherent for sure. I'm not aware of the timelines and plans for the CP and whether this change is doable before the deadline. So pinging @senadir as his input is relevant here.
@wildworks commented on PR #12270:
3 weeks ago
#92
The orientation of the search icon has been discussed a few times before. See https://github.com/WordPress/gutenberg/pull/72070. My understanding is that in LTR languages, the search icon should face left.
So the search icon in the Command Palette should be facing the correct direction:
I think the ones that need fixing are SearchableSelectControl, the admin bar in the admin, and the admin bar on the front end.
| Component | Screenshot |
|---|---|
| SearchableSelectControl | |
| Admin bar (admin) | |
| Admin bar (front end) | |
cc @WordPress/gutenberg-components
@fushar commented on PR #12270:
3 weeks ago
#93
Thanks for the additional context 😄 the search icon direction is now fixed in the latest commit 6c3fc8b059641be15c5512a519fff4e43b51cf9c.
@fcoveram commented on PR #12270:
3 weeks ago
#94
The icon direction looks correct now ✨
@fushar commented on PR #12270:
3 weeks ago
#95
@peterwilsoncc Let's discuss your comment here instead of on the diff. GitHub UI is bad for PRs with many comments; it's hard to follow chronological discussion 😅
Reading the comment, I think there's a bit a more fundamental issue here. If plugins want to "migrate" their dashicons to SVG icons, should we tell them to use core-admin/ or core/ collection? Both have issues:
- If they're supposed to use
core-admin/only, the collection currently only has few icons, because the set was meant to contain only Core's built-in icons. - If they may use
core/, then they won't survive when thecore/collection is unregistered. See the discussion in the original PR, the main idea being that we don't want the icons in the admin screens to be unregisterable at all.
I'm thinking a few approaches here:
- Expand
core-admin/collection to have a few more "popular" icons fromcore/. - Or just simply make
core-admin/a proper superset ofcore/.
- And we might optionally ban
core/from being used when constructing the sidebar menu and admin bar nodes. (Not sure)
Sorry, I just realized about this now. I might be overthinking, but the potential confusion is real here.
Thoughts @t-hamano, @tyxla, @mcsf ?
@wildworks commented on PR #12270:
3 weeks ago
#96
Reading the comment, I think there's a bit a more fundamental issue here. If plugins want to "migrate" their dashicons to SVG icons, should we tell them to use
core-admin/orcore/collection? Both have issues:
- If they're supposed to use
core-admin/only, the collection currently only has few icons, because the set was meant to contain only Core's built-in icons.- If they may use
core/, then they won't survive when thecore/collection is unregistered. See the discussion in the original PR, the main idea being that we don't want the icons in the admin screens to be unregisterable at all.
@fushar Thanks for raising this. I agree that your concern is valid.
Here are my thoughts and suggestions:
core-adminis still the collection for wp-admin, whilecoreis the collection for the front end, content, and the Icon block.- Don't automatically migrate Dashicons to SVG icons at all. It's not possible to map every Dashicon one-to-one to an SVG icon in the first place. The only exception is the core menu items, which are migrated to SVG icons (third-party items are not).
- Let consumers know the following through the dev note:
- Encourage them to use SVG icons instead of Dashicons where possible when registering menus and post types.
- Publish the list of icons currently available in the
core-admincollection.
- Expand the
core-adminicons as much as possible, based on requests from developers or as a follow-up.
I tried installing a lot of plugins, and personally, I don't find the mix of SVG icons and Dashicons that jarring. What do you think?
@fushar commented on PR #12270:
3 weeks ago
#97
Thanks @t-hamano I agree with all your suggestions. They make sense to me. Particulary:
I tried installing a lot of plugins, and personally, I don't find the mix of SVG icons and Dashicons that jarring.
Yep, I agree. I know that @jasmussen et al have designed the icons in such a way that they don't look too out of place compared to the original Dashicons 🙂
Let consumers know the following through the dev note
I'll add that to the dev note.
Expand the core-admin icons as much as possible
Yeah, agree. I think we should add more generic icons, like envelope, cart, etc. That would need to happen on Gutenberg first (I can try to raise the PR). WDYT @jasmussen?
@tyxla commented on PR #12270:
3 weeks ago
#98
I agree with @t-hamano's plan, including not auto-mapping third-party dashicons, with a few small notes:
- If the dev note tells plugins to use
core-admin/*, those icons become public API, even withpublic => false. We'll likely want to say this clearly in the dev note and thewp_register_icon()docs. We'll also have to agree that we never rename or remove an icon once it's added. - Worth mentioning in the dev note that plugins can register their own collection (like
my-plugin/cart). It already works in menus and the admin bar. - I'd prefer not banning public collections. New collections are public by default, so a ban would also block plugin icons and adding unnecessarily limits.
@fushar commented on PR #12270:
3 weeks ago
#99
Stroke width on mobile
With the stroke scaling work (https://github.com/WordPress/gutenberg/pull/84081), the 32px size becomes bolder. I see that non-scaling-stroke is still there, so a follow-up would be to find a coherent way to use icons that keeps the stroke width the same in both the admin bar and the sidebar.
WordPress icon scale
The WordPress icon looks slightly bigger because it uses 20 of the 24 units in its container. Until the icon becomes stroke-based, perhaps we can scale it to 18px inside the same 24px container. This also relates to https://github.com/WordPress/gutenberg/pull/84105.
I wonder if we can approach it differently and apply an ad hoc property that scales it to 18px inside the same 24px container.
Honestly, I don't fully understand this and this is a bit beyond my expertise 😄 I'd like to defer the implementation details to the icon designers @jasmussen / @lucasmendes-design. We should be able to follow up as separate PR during the Beta if needed.
@fushar commented on PR #12270:
3 weeks ago
#100
Folks, thanks for all the help and feedback for this PR so far. Really appreciate it. As Beta 1 is around the corner, I think we should wrap up this PR soon if we want to include it in 7.2. Based on what I read so far, there's no major blocker. What's left is to have an agreement on the proposed back-compat strategy in the dev note, and test its claims. Personally, I've already tested this PR so many times with various plugins / color schemes 🙂
@peterwilsoncc commented on PR #12270:
3 weeks ago
#101
Hey folks, sorry I'd missed the resolutions of the previous comments -- as @fushar said, the GH UI can sometimes be confusing.
Folks, thanks for all the help and feedback for this PR so far. Really appreciate it. As Beta 1 is around the corner, I think we should wrap up this PR soon if we want to include it in 7.2. Based on what I read so far, there's no major blocker. What's left is to have an agreement on the proposed back-compat strategy in the dev note, and test its claims. Personally, I've already tested this PR so many times with various plugins / color schemes 🙂
Agreed: this can go in beta 1 and further substitutions discussed and an approach figured out during the beta period.
I do like the idea of including the converted icons in the core group within the core-admin group. The font's name dashicons does imply they are available in the dashboard so it's not an unreasonable assumption that the converted icons will be available in the dash.
It would be good to get the dev note out very shortly after beta 1 so devs in plugin land can provide feedback asap.
#102
@
3 weeks ago
- Milestone Awaiting Review → 7.2
It seems we forgot to set the milestone for this ticket to 7.2.
@fushar commented on PR #12270:
3 weeks ago
#103
There are two things I'd like to note, both of which can probably be explored in follow-ups:
Yep, I think they can be followed up later and don't need to block this PR 😄
Thanks for all your reviews!
@Joen commented on PR #12270:
3 weeks ago
#104
Catching up, please let me know if I missed anything, it was Danish potato vacation last week.
Yeah, agree. I think we should add more generic icons, like envelope, cart, etc. That would need to happen on Gutenberg first (I can try to raise the PR).
I agree, and yes please open issues, happy to draw. To note, though, envelope and cart both exist, same names.
Honestly, I don't fully understand this and this is a bit beyond my expertise 😄 I'd like to defer the implementation details to the icon designers @jasmussen / @lucasmendes-design. We should be able to follow up as separate PR during the Beta if needed.
That's from this comment, and I can unpack it: the new icons have flexibility the old ones didn't: we can tweak the stroke-width. There's an ongoing question around whether we should, and even how we tweak it if we do. All of that, honestly I'm increasingly leaning towards the instincts of Fran, Aki, @jameskoster and @ciampo on the precise details.
What we do, if anything, in this iteration, I think should not overall affect what we do with this branch: one of the benefits of unifying on WordPress icons (which is the overwhelming focus of this branch), is to unify the codebase too, so whatever improvements we make to the core set, including any changes to stroke-scaling behavior for better legibility, will benefit the admin in future iterations too. So I don't know that we should do any local changes here in this branch or not, I lean to whatever is the simplest to let us focus on the shipping. Is that helpful?
lucasmendes-design commented on PR #12270:
3 weeks ago
#106
Catching up as well. I agree with @jasmussen. No icon-specific changes in this branch. Both open design points are library questions, and Core gets the answer when it bumps @wordpress/icons.
#109
follow-up:
↓ 110
@
3 weeks ago
Shouldn't we also replace the icons in the "At a Glance" dashboard widget?
This ticket was mentioned in PR #14903 on WordPress/wordpress-develop by @fushar.
12 days ago
#112
Replaces the hard-coded Dashicon list in _wp_menu_output() with a mapping from the icon library manifest, so admin menu items that use a mapped Dashicon, including those of plugins and custom post types, are rendered with the SVG icon.
- New private
_wp_get_admin_icon_name_for_dashicon( $dashicon ), backed byWP_Icons_Registry::get_admin_icon_name_for_dashicon(). It reads the newdashiconsproperty of thecore-adminicons in the manifest, and returns, for example,core-admin/pinfordashicons-admin-post, ornullwhen the Dashicon has no mapping or its icon is not registered. _wp_menu_output()calls it in place of its hard-coded list. A Dashicon whose replacement icon is not registered now falls back to the Dashicons font.icon-library-manifest.phpaddsdashiconsto the 36 icons that are already incore-admin. The mapping is maintained in Gutenberg (WordPress/gutenberg#85541), and the next Gutenberg sync replaces this subset with the full mapping.- With the Gutenberg plugin active, its registry subclass overrides the method, so the plugin's mapping applies.
Testing Instructions
npm run test:php -- --filter 'Tests_Icons_WpGetAdminIconNameForDashicon|Tests_Admin_WpMenuOutput'- Register a post type with
'menu_icon' => 'dashicons-cart', and check that its admin menu item shows the SVG cart icon. A Dashicon without a mapping, such asdashicons-heart, still shows the Dashicons font icon.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: The code, tests and this description, under my direction.
This ticket was mentioned in PR #14974 on WordPress/wordpress-develop by @wildworks.
11 days ago
#113
Proof of concept: limit the automatic Dashicon-to-SVG replacement to core menu items.
Currently, any menu item that uses one of the Dashicons of the core menu items (e.g. dashicons-admin-post) is rendered as an SVG icon, including plugin menu items and custom post types without a menu_icon. This PR maps the replacements by the ID of the core menu item, and only while the item still uses its default Dashicon. Other menu items keep their Dashicon, and can opt in to an SVG icon by registering an icon name.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Implementation and tests.
---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
🤖 Generated with Claude Code
@Mamaduka commented on PR #14903:
11 days ago
#114
All checks are passing after 909edaf5d8f30d94b18f5cbd9813368f70dce2e8. Tested the icons and Playground; they render as expected. Going to commit.
@Mamaduka commented on PR #14974:
11 days ago
#116
Closing in favor of #14903.
@Mamaduka commented on PR #14903:
11 days ago
#117
This ticket was mentioned in PR #14999 on WordPress/wordpress-develop by @fushar.
11 days ago
#118
Proposed changes
Trac ticket: https://core.trac.wordpress.org/ticket/65089
This PR proposes to hide .ab-item::before on any node that renders an SVG icon, so only the SVG icon shows.
See the "Change to the unpublished dev note" section below to see how this affect the dev note.
Benefit for plugin authors
Because of this, a plugin can pass the new icon argument and keep drawing a Dashicon on .ab-item::before, without checking the WordPress version:
$wp_admin_bar->add_node( array( 'id' => 'my-plugin-notes', 'icon' => 'core-admin/pin', // Used in 7.2, ignored before. 'title' => __( 'Notes', 'my-plugin' ), 'href' => admin_url( 'admin.php?page=my-plugin-notes' ), ) );
/* Used before 7.2, hidden in 7.2. */ #wpadminbar #wp-admin-bar-my-plugin-notes > .ab-item::before { content: "\f109"; /* dashicons-admin-post */ }
- Before 7.2: the
iconargument is ignored, and the Dashicon is drawn. - In 7.2: the SVG icon is drawn, and the Dashicon is hidden.
This is similar to add_menu_page(), where a plugin can keep passing a Dashicon such as dashicons-admin-post, and 7.2 renders its replacement SVG icon (core-admin/pin), without any version check.
add_menu_page( __( 'Notes', 'my-plugin' ), __( 'Notes', 'my-plugin' ), 'manage_options', 'my-plugin-notes', 'my_plugin_render_notes', 'dashicons-admin-post' // Dashicon before 7.2, `core-admin/pin` SVG icon in 7.2. );
Change to unpublished dev note
The draft dev note for the SVG icons (not published yet) currently says:
Replacing an admin bar icon through
.ab-item::beforeThis applies to the admin bar nodes whose icon used to be drawn on
.ab-item::before:edit,customize,site-editor,my-sites,site-nameandmy-account. The icon is now a separate.ab-iconelement, so acontentset on.ab-item::beforeno longer replaces it. Your glyph is still drawn, but core's icon is shown as well.
To fix it, set the
contenton the::beforeof the icon element, which takes the place of core's icon.
/* Before */ #wpadminbar #wp-admin-bar-edit > .ab-item::before { content: "\f319"; }
/* After (7.2 only) */ #wpadminbar #wp-admin-bar-edit > .ab-item .ab-icon::before { content: "\f319"; }
To keep the old rule for earlier versions, limit it to links without the icon element. Otherwise both glyphs show.
/* After (works on 7.2 and earlier versions) */ #wpadminbar #wp-admin-bar-edit > .ab-item:not(:has(> .ab-icon))::before { content: "\f319"; } #wpadminbar #wp-admin-bar-edit > .ab-item .ab-icon::before { content: "\f319"; }
If this PR is accepted, the section will be SIMPLER. It will be updated to:
Replacing an admin bar icon through
.ab-item::beforeThis applies to the admin bar nodes whose icon used to be drawn on
.ab-item::before:edit,customize,site-editor,my-sites,site-nameandmy-account. The icon is now a separate.ab-iconelement, so acontentset on.ab-item::beforeno longer replaces it. Your glyph is hidden, and core's icon is shown instead.
To fix it, set the
contenton the::beforeof the icon element, which takes the place of core's icon.
/* Before */ #wpadminbar #wp-admin-bar-edit > .ab-item::before { content: "\f319"; }
/* After (works on 7.2 and earlier versions) */ #wpadminbar #wp-admin-bar-edit > .ab-item::before, #wpadminbar #wp-admin-bar-edit > .ab-item .ab-icon::before { content: "\f319"; }
Use of AI Tools
Used Claude Opus 5.5 to discuss the approach and implement the change.
@fushar commented on PR #14999:
10 days ago
#119
Thanks for testing, reviewing, and pointing out the handbook page. Addressed the comments 👍
@fushar commented on PR #14999:
9 days ago
#120
@peterwilsoncc: I added the last commit to address @mcsf's comment from the previous PR. Let us know what you think.
@sadmansakibnadvi commented on PR #14999:
9 days ago
#121
Tested bd11baf on 7.2-beta3-64990, counting visible icons per toolbar node in Chrome. Way 1 and Way 2 nodes that pass icon go from 2 icons to 1, and a plugin glyph on the core edit node's .ab-item::before is hidden. Nodes without icon, Duplicate Post 4.7 and Password Protected 2.8.5 are unchanged. The unregistered icon case now keeps the original title with no empty wrapper.
Full table on the ticket: https://core.trac.wordpress.org/ticket/65089
@peterwilsoncc commented on PR #14999:
9 days ago
#122
@propsbot add @mcsf
@peterwilsoncc commented on PR #14999:
8 days ago
#123
@fushar I'm seeing a random gap when using an invalid icon name with the dashicon, to my test plugin above I added:
$wp_admin_bar->add_node( array( 'id' => 'example4', 'icon' => 'core-admin/invalid-icon-name', 'title' => __( 'Example 4', 'my-plugin' ), 'href' => admin_url( 'admin.php?page=my-plugin-notes' ), ) );
and
#wpadminbar #wp-admin-bar-example4 > .ab-item::before { content: "\f109"; /* dashicons-admin-post */ }
In the admin bar the dashicon is shown but there is an empty space for the SVG icon that isn't shown as the mark-up includes <span class="ab-icon svg-icon" aria-hidden="true"></span>
@fushar commented on PR #14999:
8 days ago
#124
I'm seeing a random gap when using an invalid icon name with the dashicon, to my test plugin above I added:
@peterwilsoncc: yeah, it's an edge case. There are two ways to add dashicon in admin bar nodes:
- Using CSS on
.ab-item::before(your case) - Using empty
<span class="ab-icon dashicons-*"></span>in the title. I believe this is more common as this doesn't require enqueuing CSS.
If the dashicon is added using (2), it's already handled in this PR. Your case (1) is the only edge case missing. It's hard to "fix" it because we can't detect the presence of such CSS-added dashicons in PHP side.
If we want to "fix" it, one idea is to hide the empty slot using CSS something like this, but not sure if it's worth it:
/* * Dashicons back-compat: when the icon is not registered, an icon drawn on `.ab-item::before` takes the place of * the empty icon element instead of showing next to it. */ #wpadminbar .ab-item:has(> .ab-icon.svg-icon:empty)::before { width: 24px; margin-right: -24px; text-align: center; }
What do you think?
I'm sorry that this PR is becoming more complicated... but admin bar logic is already complicated. It seems we can simplify things e.g. using @t-hamano 's CSS but we need to give up some back-compat behaviors. I'll also brainstorm in the meantime.
@fushar commented on PR #14999:
8 days ago
#125
It seems we can simplify things e.g. using @t-hamano 's CSS but we need to give up some back-compat behaviors.
So I believe the complications come from us trying to have back-compat logic for plugins that modify core nodes. Core nodes inconsistently add dashicons using both .ab-item::before and .ab-icon::before, so it's complicated. For example my comment here: https://github.com/WordPress/wordpress-develop/pull/14999#discussion_r4420054526
So maybe, if we give up some of that and instead focus on providing a clean way where plugin's add_node() code can work before and after 7.2 (which originally what this PR is trying to do), maybe that results in cleaner logic in core side and is actually a better win?
@fushar commented on PR #14999:
8 days ago
#126
Thanks all for the patience... I think I managed to implement @t-hamano's idea to hide the old dashicon via CSS. But it has one cost: now unregistered icon will show nothing instead of an empty slot wrapper. I think this is acceptable, since we still report on debug with _doing_it_wrong().
Please check the test cases here: https://htmlpreview.github.io/?https://github.com/fushar/wordpress-develop/blob/f832b0c4d51b33019381ea23182d0c9a59c061f8/index.html. I think the back-compat behavior is sufficient. The only breakage is when the code manipulates .ab-item::before, but even so it fails gracefully without weird double icons or weird gap.
@fushar commented on PR #14999:
5 days ago
#127
If I understand correctly, what we're aiming for is the same as the admin menu: replace Dashicons with SVG icons in as many scenarios as possible, without forcing developers to write back-compat code.
Yes, that's the goal!
What do you think? Am I missing anything that would affect backward compatibility?
No, you're not missing anything 😄 at this point this really is down to what we want to support for back-compat. For example, with your proposal, the following will break:
- The
$wp_admin_bar->get_nodes()data (especiallytitleof nodes) will change, so plugins that manipulate core node titles assuming the old html markup, will potentially break. - "if a plugin calls remove_node() and then re-adds a node with the same ID (such as edit) without the icon argument, the node no longer gets an icon." <- this one will break as mentioned as well.
What's more important is having a way for plugin authors to write code that works across versions as non-complicated as possible. I believe your and my versions already satisfy that requirement. So now this boils down to simpler core code vs better back-compat.
@wildworks commented on PR #14999:
5 days ago
#128
So now this boils down to simpler core code vs better back-compat.
Personally, I prefer starting with a simple approach and iterating based on consumer feedback. Trying to cover every edge case from the beginning overcomplicates the logic, making it harder for consumers to understand the rules. That said, I think either approach could work. Since you know this feature best, I defer to your judgment 🙂
@fushar commented on PR #14999:
5 days ago
#129
Personally, I prefer starting with a simple approach and iterating based on consumer feedback. Trying to cover every edge case from the beginning overcomplicates the logic, making it harder for consumers to understand the rules.
Interesting, this makes sense.
I think I'm starting to like your approach. If we do that, then in 7.2 Core finally have a consistent structure for admin bar nodes (title + icon, except wp-logo which has no text to manipulate in the first place). If we use the logic in this PR, then we have to maintain that complicated logic forever.
Is there still a time to switch to your approach? Is there a time to pivot to another approach in RC if we have more feedback? Also, I've been holding off releasing the dev note until we settle on this backcompat story 🙂
cc: release tech leads @peterwilsoncc, @Mamaduka
@wildworks commented on PR #14999:
5 days ago
#130
If we do that, then in 7.2 Core finally have a consistent structure for admin bar nodes (title + icon, except
wp-logowhich has no text to manipulate in the first place). If we use the logic in this PR, then we have to maintain that complicated logic forever.
Exactly. My preference is to minimize exceptions as much as possible and start small and simple.
Is there a time to pivot to another approach in RC if we have more feedback?
In my opinion, this should still be possible since we are currently in the beta phase. If time permits, I would like to see either this PR or mine committed by Beta 3, and then make any final adjustments by Beta 4 or RC 1 if necessary.
@fushar commented on PR #14999:
5 days ago
#131
For reference, I regenerated the test case report using Aki's proposal, showing the difference between the existing PR and the proposal: https://htmlpreview.github.io/?https://github.com/fushar/wordpress-develop/blob/c54f9f3/compare.html
I added 3 new cases where the back-compat logic would fail below:
Everything else is good.
@wildworks commented on PR #14999:
5 days ago
#132
Thanks for the comparison, @fushar!
---
Core node whose title is edited assuming the original empty span.
I think this is quite a rare case. Plugins can already replace the title entirely, so I expect very few developers would edit it by relying on the empty span being there.
---
Core node removed and added back, with its title and link copied.
Core node other than wp-logo whose title is replaced by one with no empty span.
These two could be solved by putting the SVG icon in the title of the core nodes that had their icon in the title in 7.1. However, it feels odd for core not to use the new icon argument itself while we are promoting it to plugin developers 🤔
Personally, I think these cases are acceptable, and we can cover them in the dev note.
@fushar commented on PR #14999:
4 days ago
#133
However, it feels odd for core not to use the new icon argument itself while we are promoting it to plugin developers
That's actually a good point. 😅
What if we do your simpler patch, then ship Beta 4 + dev note and see if we have feedback?
It seems @peterwilsoncc (who's been quite involved in the feature) is AFK right now to give opinion.
@wildworks commented on PR #14999:
4 days ago
#134
What if we do your simpler patch, then ship Beta 4 + dev note and see if we have feedback?
Personally, I prefer this one 👍
@wildworks commented on PR #14999:
4 days ago
#135
then ship Beta 4
If we can make it in time, I would like to release it in Beta 3 (Tuesday, 3rd at 15:00 UTC).
@Mamaduka commented on PR #14999:
4 days ago
#136
Beta 3 shipped last week with the security release. We'll do beta 4 and 5 instead.
@peterwilsoncc commented on PR #14999:
3 days ago
#138
Merged r65223 / https://github.com/WordPress/wordpress-develop/commit/855f071608b92290ddb62e2dbe2548204fc9c3b3
Thanks for looking after this folks, it's looking really good when running my test plugin.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This could have some benefits for accessibility, although issues like screen reader announcements are largely irrelevant, now that generated content allows for alt attributes in CSS (which is already implemented in the WordPress CSS.)
Support for
aria-labelis also relatively irrelevant, as that's just an implementation detail which can also be done with font-icons, just in a different way.However, the performance implementations and the need to continue to extend the icon set are definitely important considerations that should drive this forward.
For accessibility, the font replacement issue is probably the largest benefit.