Skip to content
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

#59094: Sort font library modal tabs alphabetically #68547

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

dhananjaykuber
Copy link
Contributor

Fixes #59094

What?

Add alphabetical sorting to Font Library modal tabs to provide a consistent and predictable tab order.

Why?

When multiple font collections are added to the site, the Font Library modal tabs need a defined ordering system. Alphabetical sorting provides a logical, user-friendly organization that makes it easier to locate specific font collections.

How?

Implemented alphabetical sorting of tabs using JavaScript's sort method with localeCompare for proper string comparison. The tabs array is sorted before rendering while maintaining the connection between tab headers and their corresponding content panels.

const sortedTabs = [ ...tabs ].sort( ( a, b ) => 
    a.title.localeCompare( b.title ) 
);

Testing Instructions

  1. Open the Site Editor
  2. Go to Styles panel
  3. Click on Manage Fonts icon
  4. Check the Font Library Modal

Screenshots or screencast

Screenshot 2025-01-08 at 1 59 50 PM

Copy link

github-actions bot commented Jan 8, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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

Co-authored-by: dhananjaykuber <[email protected]>
Co-authored-by: matiasbenedetto <[email protected]>

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font Library: font collections order
1 participant