Fix language attribute of top level html tag (#1705)

Sets aka "fixes" the language attribute of the top level html tag. This was hard coded to 'en' before, what led to bad experiences with screen readers. We now set overwrite the attribute with the language from i18next.
This commit is contained in:
René Pfeuffer
2021-06-21 13:10:08 +02:00
committed by GitHub
parent 0af1d4058e
commit 8e47238bf7
2 changed files with 7 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Language tag of top level html element ([#1705](https://github.com/scm-manager/scm-manager/pull/1705))

View File

@@ -29,6 +29,7 @@ import ScrollToTop from "./ScrollToTop";
import IndexErrorPage from "./IndexErrorPage";
import { useIndex } from "@scm-manager/ui-api";
import { Link } from "@scm-manager/ui-types";
import i18next from "i18next";
const Index: FC = () => {
const { isLoading, error, data } = useIndex();
@@ -36,6 +37,10 @@ const Index: FC = () => {
// TODO check componentDidUpdate method for anonymous user stuff
i18next.on("languageChanged", (lng) => {
document.documentElement.setAttribute("lang", lng);
});
if (error) {
return (
<>