feat(SW-1842): Making the language switcher links render in the initial HTML for SEO purposes, should also fix SW-1991 and SW-1742.

Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-03-24 14:12:48 +00:00
parent f633ad7fcc
commit 34bc877092
6 changed files with 83 additions and 70 deletions

View File

@@ -2,6 +2,7 @@
import { usePathname } from "next/navigation"
import { useRef } from "react"
import FocusLock from "react-focus-lock"
import { useIntl } from "react-intl"
import { languages } from "@/constants/languages"
@@ -118,14 +119,14 @@ export default function LanguageSwitcher({ type }: LanguageSwitcherProps) {
<div
className={`${styles.dropdown} ${isLanguageSwitcherOpen ? styles.isExpanded : ""}`}
>
{isLanguageSwitcherOpen ? (
<FocusLock returnFocus={true} disabled={!isLanguageSwitcherOpen}>
<LanguageSwitcherContainer type={type}>
<LanguageSwitcherContent
urls={languagesResponse.urls}
onLanguageSwitch={() => toggleDropdown(dropdownType)}
/>
</LanguageSwitcherContainer>
) : null}
</FocusLock>
</div>
</div>
)