Skip to content

Commit

Permalink
Sort templates by the rendered title instead of the slug (#50353)
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz authored May 8, 2023
1 parent f42be39 commit 3303a45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/edit-site/src/components/list/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default function Table( { templateType } ) {
}

const sortedTemplates = [ ...templates ];
sortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );
sortedTemplates.sort( ( a, b ) =>
a.title.rendered.localeCompare( b.title.rendered )
);

return (
// These explicit aria roles are needed for Safari.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export default function SidebarNavigationScreenTemplates() {
}
);
const sortedTemplates = templates ? [ ...templates ] : [];
sortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );
sortedTemplates.sort( ( a, b ) =>
a.title.rendered.localeCompare( b.title.rendered )
);

const browseAllLink = useLink( {
path: '/' + postType + '/all',
Expand Down

1 comment on commit 3303a45

@github-actions
Copy link

Choose a reason for hiding this comment

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

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

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4912022862
📝 Reported issues:

Please sign in to comment.