mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
fix(a11y): WCAG 3.1.2 — set HTML lang attribute dynamically from locale (#39243)
Co-authored-by: Fedo Hagge-Kubat <office@aitema.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user