From 914cb9491a19dd011fc3ed50373c331f28b1dfe2 Mon Sep 17 00:00:00 2001 From: Adithyakp86 Date: Mon, 20 Oct 2025 15:34:46 +0530 Subject: [PATCH] a11y: add ARIA labels to sample buttons; improve live region with aria-busy and focus management on result updates --- static/script.js | 8 ++++++++ templates/index.html | 10 +++++----- templates/index_i18n.html | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/static/script.js b/static/script.js index ac23276..8419df8 100644 --- a/static/script.js +++ b/static/script.js @@ -347,6 +347,14 @@ if (elements.predictionResult) { elements.predictionResult.className = `prediction-result show ${type}`; + // Manage ARIA busy state for screen readers during updates + if (type === 'loading') { + elements.predictionResult.setAttribute('aria-busy', 'true'); + } else { + elements.predictionResult.setAttribute('aria-busy', 'false'); + // Move focus to result container so the live region is announced + elements.predictionResult.focus(); + } } // Handle loading state diff --git a/templates/index.html b/templates/index.html index 46c2200..8afa653 100644 --- a/templates/index.html +++ b/templates/index.html @@ -220,9 +220,9 @@

Quick Fact Checker

Try these examples:

- - - + + +
@@ -241,7 +241,7 @@

Quick Fact Checker

-
+
Quick Fact Checker
Analysis Result
-
Processing your text...
+
Processing your text...
diff --git a/templates/index_i18n.html b/templates/index_i18n.html index e066e9f..f21e7ec 100644 --- a/templates/index_i18n.html +++ b/templates/index_i18n.html @@ -118,9 +118,9 @@

Quick Fact Checker

Try these examples:

- - - + + +
@@ -140,7 +140,7 @@

Quick Fact Checker

-
+
@@ -149,7 +149,7 @@

Quick Fact Checker

Analysis Result
-
Processing your text...
+
Processing your text...