Skip to content

Commit b2b03f8

Browse files
committed
fix(ui-components): implement hrefLang in language selector for better a11y
1 parent 7a8d5bd commit b2b03f8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/ui-components/src/Common/LanguageDropDown/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ const LanguageDropdown: FC<LanguageDropDownProps> = ({
3535
sideOffset={5}
3636
>
3737
<div>
38-
{availableLanguages.map(({ name, code, localName }) => (
38+
{availableLanguages.map(({ name, code, localName, hrefLang }) => (
3939
<DropdownMenu.Item
4040
key={code}
41-
onClick={() => onChange({ name, code, localName })}
41+
lang={hrefLang}
42+
onClick={() => onChange({ name, code, localName, hrefLang })}
4243
className={classNames(styles.dropDownItem, {
4344
[styles.currentDropDown]: code === currentLanguage,
4445
})}

packages/ui-components/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ export type SimpleLocaleConfig = {
2222
code: string;
2323
localName: string;
2424
name: string;
25+
hrefLang: string;
2526
};

0 commit comments

Comments
 (0)