diff --git a/docs/src/components/version-switcher.tsx b/docs/src/components/version-switcher.tsx index 016e4ac1e6d..5cb23891aa7 100644 --- a/docs/src/components/version-switcher.tsx +++ b/docs/src/components/version-switcher.tsx @@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react'; export default function VersionSwitcher(): JSX.Element { const [versions, setVersions] = useState([]); - const [label, setLabel] = useState('Versions'); + const [activeLabel, setLabel] = useState('Versions'); const windowSize = useWindowSize(); @@ -48,12 +48,13 @@ export default function VersionSwitcher(): JSX.Element { versions.length > 0 && ( ({ label, to: new URL(location.pathname + location.search + location.hash, url).href, target: '_self', + className: label === activeLabel ? 'dropdown__link--active menu__link--active' : '', // workaround because React Router `` only supports using URL path for checking if active: https://v5.reactrouter.com/web/api/NavLink/isactive-func }))} /> )