Variants Sorting: Sort by language name (fix #21408) - #21435
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where variant sorting was incorrectly using the variant name instead of the language name for alphabetical ordering. The fix ensures that variants are sorted by their language name, which provides more consistent and expected behavior across the application.
Changes:
- Modified the
sortVariantsfunction to sort by language name instead of variant name - Applied sorting logic to the Document Language picker element to ensure consistent ordering
- Added documentation for the variant sorter method in the base workspace component
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/utils.ts | Fixed the sorting comparison to use language?.name instead of variant?.name for alphabetical ordering |
| src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts | Implemented automatic sorting of variant language options using the fixed sortVariants function |
| src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-split-view/workspace-split-view-variant-selector.element.ts | Added JSDoc documentation to clarify the purpose of the _variantSorter method |
…als/shared/document-variant-language-picker.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ts/workspace-split-view/workspace-split-view-variant-selector.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ls.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
nielslyngsoe
enabled auto-merge (squash)
January 19, 2026 13:59
AndyButland
disabled auto-merge
January 23, 2026 06:53
AndyButland
approved these changes
Jan 23, 2026
AndyButland
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me @nielslyngsoe - I've tested and can confirm the fix:

Before the fix Italian was above French, as I'd created it earlier.
nielslyngsoe
added a commit
that referenced
this pull request
Jan 23, 2026
* Sort at last by language name * ensure document language picker is sorted as variant selector * Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Umbraco.Web.UI.Client/src/packages/core/workspace/components/workspace-split-view/workspace-split-view-variant-selector.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/utils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor to avoid inline methods * transform into a function * revert config file commit --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Corrects sorting method to sort by Language name instead of Variant name.
Also implements the sorting logic for the Document Language picker.
Fixes #21408