Skip to content

Variants Sorting: Sort by language name (fix #21408) - #21435

Merged
nielslyngsoe merged 9 commits into
v18/devfrom
v17/bugfix/21408
Jan 23, 2026
Merged

Variants Sorting: Sort by language name (fix #21408)#21435
nielslyngsoe merged 9 commits into
v18/devfrom
v17/bugfix/21408

Conversation

@nielslyngsoe

Copy link
Copy Markdown
Member

Corrects sorting method to sort by Language name instead of Variant name.
Also implements the sorting logic for the Document Language picker.

Fixes #21408

Copilot AI review requested due to automatic review settings January 16, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 sortVariants function 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

Comment thread src/Umbraco.Web.UI.Client/src/packages/documents/documents/utils.ts Outdated
@nielslyngsoe
nielslyngsoe changed the base branch from main to v18/dev January 16, 2026 16:16
@nielslyngsoe
nielslyngsoe changed the base branch from v18/dev to main January 16, 2026 16:16
@nielslyngsoe
nielslyngsoe changed the base branch from main to v18/dev January 16, 2026 16:18
nielslyngsoe and others added 5 commits January 16, 2026 17:19
…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
nielslyngsoe enabled auto-merge (squash) January 19, 2026 13:59
@AndyButland
AndyButland disabled auto-merge January 23, 2026 06:53

@AndyButland AndyButland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me @nielslyngsoe - I've tested and can confirm the fix:
image

Before the fix Italian was above French, as I'd created it earlier.

@nielslyngsoe
nielslyngsoe changed the base branch from v18/dev to main January 23, 2026 07:33
@nielslyngsoe
nielslyngsoe changed the base branch from main to v18/dev January 23, 2026 07:34
@nielslyngsoe
nielslyngsoe merged commit e53b8bc into v18/dev Jan 23, 2026
28 checks passed
@nielslyngsoe
nielslyngsoe deleted the v17/bugfix/21408 branch January 23, 2026 08:18
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent order of variants

4 participants