Repository navigation
Icon block: Show collection name in the "All" tab of the icon library #84055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
t-hamano
merged 6 commits into
WordPress:trunk
from
prasadkarmalkar:add/icon-block-collection-label
Oct 12, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d1f19bb
Icon block: Show collection name in the "All" tab of the icon library
prasadkarmalkar 0cba690
Merge branch 'trunk' into add/icon-block-collection-label
prasadkarmalkar d9ef451
Merge branch 'trunk' into add/icon-block-collection-label
prasadkarmalkar 3861417
Icon block: Group the "All" tab of the icon library by collection
prasadkarmalkar 2dd9c81
Merge branch 'trunk' into add/icon-block-collection-label
prasadkarmalkar eb88a30
Icon: Fix sticky group heading shift and remove ineffective aria-label
prasadkarmalkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/block-library/src/icon/components/custom-inserter/utils.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * Groups icons by collection, in the order of `collections`. | ||
| * | ||
| * @param {Object[]} icons Icons, each with a `collection` slug. | ||
| * @param {Object[]} collections Icon collections, each with a `slug` and `label`. | ||
| * @return {Object[]} Groups, each with a `slug`, `label` and `icons`. | ||
| */ | ||
| export function groupIconsByCollection( icons, collections ) { | ||
| const groups = new Map( | ||
| collections.map( ( { slug, label } ) => [ | ||
| slug, | ||
| { slug, label, icons: [] }, | ||
| ] ) | ||
| ); | ||
|
|
||
| icons.forEach( ( icon ) => { | ||
| groups.get( icon.collection )?.icons.push( icon ); | ||
| } ); | ||
|
|
||
| return [ ...groups.values() ].filter( ( group ) => group.icons.length ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the top property having a negative value, the title shifts by 4px when scrolling.
icon-shift.mp4
To avoid this, a negative top margin would likely be effective.
However, because this style also affects subsequent headings, they appear slightly shifted upward.
Therefore, we might need a little more space between the icon groups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! The jump comes from the modal contents 4px top padding (
.components-modal__content), and only the first heading starts inside that padding. Later headings scroll up to the sticky position without jumping. We can fix this by applying the negative top margin to the first group's heading only: