From 41410f62cae1e714fcfbf150cdb2d3a2be976a78 Mon Sep 17 00:00:00 2001 From: Fedo Hagge-Kubat Date: Thu, 9 Apr 2026 20:59:57 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix(a11y):=20WCAG=203.1.2=20=E2=80=94=20set?= =?UTF-8?q?=20HTML=20lang=20attribute=20dynamically=20from=20locale=20for?= =?UTF-8?q?=20screen=20readers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- superset-frontend/src/views/App.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 270a344d817f..67d603ba861f 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -49,6 +49,13 @@ 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. +// Converts locale formats like "pt_BR" or "de-DE" to BCP-47 primary tag ("pt", "de"). +const locale = + bootstrapData.common?.locale || window.navigator.language || 'en'; +document.documentElement.lang = String(locale).split(/[_-]/)[0]; + let lastLocationPathname: string; const boundActions = bindActionCreators({ logEvent }, store.dispatch); From 1317b53dfdc2ae01780b36535f2dc836ff8f1417 Mon Sep 17 00:00:00 2001 From: Fedo Hagge-Kubat Date: Sat, 18 Apr 2026 01:06:34 +0200 Subject: [PATCH 2/2] =?UTF-8?q?fix(a11y):=20WCAG=203.1.2=20=E2=80=94=20nor?= =?UTF-8?q?malize=20locale=20to=20BCP-47=20instead=20of=20stripping=20regi?= =?UTF-8?q?on=20subtag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address Bito code review finding: preserve region subtags like pt_BR as pt-BR so screen readers get locale-specific pronunciation hints, instead of collapsing to primary tag only (pt). --- superset-frontend/src/views/App.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 67d603ba861f..4f30a552e94e 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -51,10 +51,11 @@ 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. -// Converts locale formats like "pt_BR" or "de-DE" to BCP-47 primary tag ("pt", "de"). +// 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).split(/[_-]/)[0]; +document.documentElement.lang = String(locale).replace(/_/g, '-'); let lastLocationPathname: string;