Skip to content

Commit

Permalink
feat(FEC-13835): sort captions menu in alphabetic order (#879)
Browse files Browse the repository at this point in the history
### Description of the Changes

**enhancement.**

- sort the languages in the captions menu in an alphabetic order
- keep `Off` language at the end of the list

#### Resolves FEC-13835
  • Loading branch information
lianbenjamin committed Apr 17, 2024
1 parent 1d35bf6 commit 60b7fca
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/captions-menu/captions-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ class CaptionsMenu extends Component<any, any> {
* @memberof CaptionsMenu
*/
render(props: any): VNode<any> {
const textOptions = props.textTracks.map(t => ({
label: t.label || t.language,
active: t.active,
value: t
}));
const textOptions = props.textTracks
.map(t => ({
label: t.label || t.language,
active: t.active,
value: t
}))
.sort((a, b) => a.label > b.label || a.label === 'Off' ? 1 : -1);

if (props.showAdvancedCaptionsMenu) {
textOptions.push({label: props.advancedCaptionsSettingsText, value: props.advancedCaptionsSettingsText, active: false});
Expand Down

0 comments on commit 60b7fca

Please sign in to comment.