From 4f2fa41f4ef5ce99069d8adcb8a61694c7ae8dec Mon Sep 17 00:00:00 2001 From: Aitema-gmbh Date: Mon, 20 Apr 2026 20:33:10 +0200 Subject: [PATCH] =?UTF-8?q?fix(a11y):=20WCAG=203.1.2=20=E2=80=94=20set=20H?= =?UTF-8?q?TML=20lang=20attribute=20dynamically=20from=20locale=20(#39243)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fedo Hagge-Kubat --- superset-frontend/src/views/App.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 270a344d817..4f30a552e94 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -49,6 +49,14 @@ setupAGGridModules(); const bootstrapData = getBootstrapData(); +// WCAG 3.1.2: Set the HTML lang attribute based on the current locale +// so screen readers announce the correct language for the page content. +// Normalize to BCP-47 format by replacing underscores with hyphens +// so region subtags like "pt_BR" become valid "pt-BR" rather than being dropped. +const locale = + bootstrapData.common?.locale || window.navigator.language || 'en'; +document.documentElement.lang = String(locale).replace(/_/g, '-'); + let lastLocationPathname: string; const boundActions = bindActionCreators({ logEvent }, store.dispatch);