Skip to content

Announce timer countdown for screen readers#85742

Merged
carlosmiceli merged 6 commits intomainfrom
claude-timerCountdownAccessibility
Mar 23, 2026
Merged

Announce timer countdown for screen readers#85742
carlosmiceli merged 6 commits intomainfrom
claude-timerCountdownAccessibility

Conversation

@MelvinBot
Copy link
Contributor

@MelvinBot MelvinBot commented Mar 19, 2026

Explanation of Change

This PR adds screen reader announcements for the magic code countdown timer, addressing WCAG 4.1.3 (Status Messages).

Changes:

  • ValidateCodeCountdown: Uses useAccessibilityAnnouncement hook to announce at key moments:
    1. Every 10 seconds — announces "Time remaining: 20 seconds" and "Time remaining: 10 seconds" as the countdown progresses
    2. Expiration — announces "The time has expired" when the countdown reaches 0
  • Translation keys: Added timeRemainingAnnouncement and timeExpiredAnnouncement to English and Spanish language files.

The 30-second mark is intentionally not announced to avoid interrupting other screen reader announcements. Announcements are spaced every 10 seconds (at 20s and 10s remaining) plus expiration, providing useful information without being noisy.

Fixed Issues

$ #77259

Tests

  1. Navigate to the sign-in flow or any flow that shows a magic code countdown
  2. Enable a screen reader (VoiceOver on iOS/Mac, TalkBack on Android, NVDA/JAWS on Windows)
  3. Wait for the countdown to reach 20 seconds remaining
  4. Verify the screen reader announces "Time remaining: 20 seconds"
  5. Wait for the countdown to reach 10 seconds remaining
  6. Verify the screen reader announces "Time remaining: 10 seconds"
  7. Wait for the countdown to reach 0
  8. Verify the screen reader announces "The time has expired"
  9. Request a new code to reset the countdown
  10. Verify the announcements repeat at 20s, 10s, and expiration
  • Verify that no errors appear in the JS console

Offline tests

N/A — These are purely UI accessibility announcements that don't involve network requests.

QA Steps

  1. Enable VoiceOver/TalkBack on a device
  2. Sign out and sign back in to trigger the magic code flow
  3. Verify the countdown announcements happen at 20s remaining, 10s remaining, and expiration
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

N/A — Changes are accessibility attribute additions only (no visual UI changes).

Android: mWeb Chrome

N/A — Changes are accessibility attribute additions only (no visual UI changes).

iOS: Native

N/A — Changes are accessibility attribute additions only (no visual UI changes).

iOS: mWeb Safari

N/A — Changes are accessibility attribute additions only (no visual UI changes).

MacOS: Chrome / Safari

N/A — Changes are accessibility attribute additions only (no visual UI changes).

Use useAccessibilityAnnouncement hook in ValidateCodeCountdown to announce
the countdown start (time remaining) and expiration for screen reader users.
Add translation keys for both English and Spanish.

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
@OSBotify
Copy link
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index c61d6b1b..17bd2c0f 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -2673,6 +2673,8 @@ ${amount} für ${merchant} – ${date}`,
             incorrectMagicCode: 'Falscher oder ungültiger Magic-Code. Bitte versuche es erneut oder fordere einen neuen Code an.',
             pleaseFillTwoFactorAuth: 'Bitte gib deinen Zwei-Faktor-Authentifizierungscode ein',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Verbleibende Zeit: ${timeRemaining} ${timeRemaining === 1 ? 'Sekunde' : 'Sekunden'}`,
+        timeExpiredAnnouncement: 'Die Zeit ist abgelaufen',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Bitte füllen Sie alle Felder aus',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index b8a98326..43b0d038 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -2680,6 +2680,8 @@ ${amount} pour ${merchant} - ${date}`,
             incorrectMagicCode: 'Code magique incorrect ou non valide. Veuillez réessayer ou demander un nouveau code.',
             pleaseFillTwoFactorAuth: 'Veuillez saisir votre code d’authentification à deux facteurs',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Temps restant : ${timeRemaining} ${timeRemaining === 1 ? 'seconde' : 'secondes'}`,
+        timeExpiredAnnouncement: 'Le délai est expiré',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Veuillez remplir tous les champs',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 7f8f6e3d..91473ac0 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -2669,6 +2669,8 @@ ${amount} per ${merchant} - ${date}`,
             incorrectMagicCode: 'Codice magico errato o non valido. Riprova o richiedi un nuovo codice.',
             pleaseFillTwoFactorAuth: 'Inserisci il tuo codice di autenticazione a due fattori',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Tempo rimanente: ${timeRemaining} ${timeRemaining === 1 ? 'secondo' : 'secondi'}`,
+        timeExpiredAnnouncement: 'Il tempo è scaduto',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Compila tutti i campi',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index f0eb7872..e7ace5ac 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -2651,6 +2651,8 @@ ${date} の ${merchant} への ${amount}`,
             incorrectMagicCode: '魔法コードが間違っているか無効です。もう一度お試しいただくか、新しいコードをリクエストしてください。',
             pleaseFillTwoFactorAuth: '2 要素認証コードを入力してください',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `残り時間:${timeRemaining} ${timeRemaining === 1 ? '秒' : '秒'}`,
+        timeExpiredAnnouncement: '時間切れです',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'すべての項目を入力してください',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index e96c2a8a..f3668821 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -2667,6 +2667,8 @@ ${amount} voor ${merchant} - ${date}`,
             incorrectMagicCode: 'Onjuiste of ongeldige magische code. Probeer het opnieuw of vraag een nieuwe code aan.',
             pleaseFillTwoFactorAuth: 'Voer je twee-factor-authenticatiecode in',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Resterende tijd: ${timeRemaining} ${timeRemaining === 1 ? 'seconde' : 'seconden'}`,
+        timeExpiredAnnouncement: 'De tijd is verlopen',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Vul alle velden in',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index bc7504d7..1201ce01 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -2661,6 +2661,8 @@ ${amount} dla ${merchant} - ${date}`,
             incorrectMagicCode: 'Nieprawidłowy lub niepoprawny kod magiczny. Spróbuj ponownie lub poproś o nowy kod.',
             pleaseFillTwoFactorAuth: 'Wprowadź swój kod uwierzytelniania dwuskładnikowego',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Pozostały czas: ${timeRemaining} ${timeRemaining === 1 ? 'sekunda' : 'sekundy'}`,
+        timeExpiredAnnouncement: 'Czas minął',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Proszę wypełnić wszystkie pola',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index c882118b..86b6568e 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -2660,6 +2660,8 @@ ${amount} para ${merchant} - ${date}`,
             incorrectMagicCode: 'Código mágico incorreto ou inválido. Tente novamente ou solicite um novo código.',
             pleaseFillTwoFactorAuth: 'Insira seu código de autenticação de dois fatores',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `Tempo restante: ${timeRemaining} ${timeRemaining === 1 ? 'segundo' : 'segundos'}`,
+        timeExpiredAnnouncement: 'O tempo expirou',
     },
     passwordForm: {
         pleaseFillOutAllFields: 'Por favor, preencha todos os campos',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index b4670f8f..c0c5c249 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -2609,6 +2609,8 @@ ${amount},商户:${merchant} - 日期:${date}`,
             incorrectMagicCode: '魔术验证码不正确或无效。请重试或请求新的验证码。',
             pleaseFillTwoFactorAuth: '请输入您的双重身份验证代码',
         },
+        timeRemainingAnnouncement: ({timeRemaining}: {timeRemaining: number}) => `剩余时间:${timeRemaining} ${timeRemaining === 1 ? '秒' : '秒'}`,
+        timeExpiredAnnouncement: '时间已过期',
     },
     passwordForm: {
         pleaseFillOutAllFields: '请填写所有字段',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

…nslations

Added the two new translation keys to all remaining language files
(de, fr, it, ja, nl, pl, pt-BR, zh-hans) that were missed in the
original commit, causing typecheck failures.

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
@MelvinBot
Copy link
Contributor Author

Fixed the failing typecheck: added the missing timeRemainingAnnouncement and timeExpiredAnnouncement translation keys to all 8 remaining language files (de, fr, it, ja, nl, pl, pt-BR, zh-hans) that were missed in the original commit.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/components/ValidateCodeCountdown/index.tsx 100.00% <100.00%> (ø)
... and 16 files with indirect coverage changes

Comment on lines +31 to +38
// Announce countdown start/reset for screen readers
useAccessibilityAnnouncement(translate('validateCodeForm.timeRemainingAnnouncement', {timeRemaining: CONST.REQUEST_CODE_DELAY}), timeRemaining === CONST.REQUEST_CODE_DELAY, {
shouldAnnounceOnNative: true,
shouldAnnounceOnWeb: true,
});

// Announce expiration for screen readers
useAccessibilityAnnouncement(translate('validateCodeForm.timeExpiredAnnouncement'), timeRemaining === 0, {shouldAnnounceOnNative: true, shouldAnnounceOnWeb: true});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot

Suggested change
// Announce countdown start/reset for screen readers
useAccessibilityAnnouncement(translate('validateCodeForm.timeRemainingAnnouncement', {timeRemaining: CONST.REQUEST_CODE_DELAY}), timeRemaining === CONST.REQUEST_CODE_DELAY, {
shouldAnnounceOnNative: true,
shouldAnnounceOnWeb: true,
});
// Announce expiration for screen readers
useAccessibilityAnnouncement(translate('validateCodeForm.timeExpiredAnnouncement'), timeRemaining === 0, {shouldAnnounceOnNative: true, shouldAnnounceOnWeb: true});
// Announce countdown start/reset/expiration for screen readers
useAccessibilityAnnouncement(
timeRemaining === 1 ? translate('validateCodeForm.timeExpiredAnnouncement') : translate('validateCodeForm.timeRemainingAnnouncement', {timeRemaining: timeRemaining - 1}),
timeRemaining % 10 === 1,
{
shouldAnnounceOnNative: true,
shouldAnnounceOnWeb: true,
},
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied! Consolidated the two hook calls into one that announces every 10 seconds and at expiration. Pushed in 3b6145e.

Combine two separate useAccessibilityAnnouncement calls into one that
announces every 10 seconds and at expiration, per reviewer feedback.

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
Comment on lines +33 to +34
timeRemaining === 1 ? translate('validateCodeForm.timeExpiredAnnouncement') : translate('validateCodeForm.timeRemainingAnnouncement', {timeRemaining: timeRemaining - 1}),
timeRemaining % 10 === 1,
Copy link
Contributor

@situchan situchan Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot add comment here so others don't think 10, 1 are magic numbers.

10 is to announce every 10 seconds
1 is for 1s ahead, especially when expired because this component is unmounted immediately on 0s remaining and expired message is not announced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments explaining both magic numbers. Pushed in cd5ccf3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explanatory comments in cd5ccf3 — the code now documents why we use timeRemaining === 1 (component unmounts at 0s so the announcement wouldn't be spoken) and timeRemaining % 10 === 1 (announce every 10 seconds to avoid overwhelming screen reader users).

@MelvinBot
Copy link
Contributor Author

The previously failing TypeScript Checks (missing timeRemainingAnnouncement and timeExpiredAnnouncement translation keys in de.ts, fr.ts, it.ts, ja.ts, nl.ts, pl.ts, pt-BR.ts, zh-hans.ts) has been resolved in the latest commit. The current run shows typecheck passing along with all other completed checks (ESLint, Prettier, builds, spellcheck, etc.). Unit tests and perf tests are still in progress but no failures so far.

Clarify why timeRemaining === 1 (not 0) is used for expiration check
and why timeRemaining % 10 === 1 triggers announcements every 10s.

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
@situchan
Copy link
Contributor

@MelvinBot update Tests Steps based on latest codebase.

Verify the screen reader announces "Time remaining: 30 seconds" when the countdown starts

30s remaining is intentionally not announced because it interrupts other announcements.
20s remaining, 10s remaining, time has expired announcements should happen.

@MelvinBot
Copy link
Contributor Author

Updated the PR description — Test Steps and QA Steps now reflect the actual announcement behavior:

  • Removed the 30s announcement step (intentionally skipped to avoid interrupting other announcements)
  • Added verification steps for 20s and 10s remaining announcements
  • Kept the expiration announcement step
  • Updated the Explanation of Change to match

@situchan
Copy link
Contributor

@MelvinBot mark as ready for review

@MelvinBot MelvinBot marked this pull request as ready for review March 19, 2026 16:49
@MelvinBot MelvinBot requested a review from a team as a code owner March 19, 2026 16:49
@melvin-bot melvin-bot bot requested a review from situchan March 19, 2026 16:49
@MelvinBot
Copy link
Contributor Author

PR has been marked as ready for review! ✅

@melvin-bot melvin-bot bot removed the request for review from a team March 19, 2026 16:49
@melvin-bot
Copy link

melvin-bot bot commented Mar 19, 2026

@situchan Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested review from a team and trjExpensify and removed request for a team March 19, 2026 16:49
@situchan
Copy link
Contributor

situchan commented Mar 19, 2026

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp

Tested on physical device

Android: mWeb Chrome
iOS: HybridApp

Tested on physical device

iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov

@melvin-bot
Copy link

melvin-bot bot commented Mar 19, 2026

We did not find an internal engineer to review this PR, trying to assign a random engineer to #77259 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot melvin-bot bot requested a review from youssef-lr March 19, 2026 16:50
@melvin-bot melvin-bot bot removed the request for review from a team March 19, 2026 16:50
@melvin-bot
Copy link

melvin-bot bot commented Mar 19, 2026

@youssef-lr Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested a review from carlosmiceli March 19, 2026 16:50
@situchan
Copy link
Contributor

Pert Tests failure is not related. Re-trigger might fix it.

@MelvinBot
Copy link
Contributor Author

The failing check is unrelated to this PR.

Failing check: Reassure Performance Tests — useAdvancedSearchFilters hook initial render with policies (render count deviation of 0.8 exceeded the allowed 0)

Why it's unrelated: This PR only modifies ValidateCodeCountdown and language files. The failing test is about useAdvancedSearchFilters, which is completely unrelated.

Evidence: The same Reassure Performance Test is also failing on multiple other branches today (@GCyganek/unlock-landscape-mode, fix/83563, neil-fix-83513-filtering), confirming it's a flaky test — not caused by this PR's changes.

The only other failing check is PR Reviewer Checklist, which is expected for PRs pending review.

@MelvinBot
Copy link
Contributor Author

The failing perf-tests check is unrelated to this PR.

Analysis: The failure is in useAdvancedSearchFilters hook initial render with policies — render count difference exceeded the allowed deviation of 0 (current difference: 0.8). This PR only modifies ValidateCodeCountdown/index.tsx and language translation files, which have no connection to advanced search filters.

Evidence: The perf test measures render counts for useAdvancedSearchFilters, while this PR adds screen reader announcements to the magic code countdown timer. These are completely separate code paths.

This appears to be a flaky perf test. Re-running the workflow should resolve it.

@MelvinBot
Copy link
Contributor Author

Code Review

I reviewed the full diff, the useAccessibilityAnnouncement hook (all 3 platform variants), the linked issue (#77259), and the consumer components. Here's my analysis:

Summary

This PR adds screen reader announcements to the magic code countdown timer via the existing useAccessibilityAnnouncement hook, with translations across all 10 supported languages. The change is minimal and well-scoped.

What looks good

  • Single hook call — The consolidated approach (per situchan's suggestion) is cleaner than two separate calls and correctly handles all three announcement points (20s, 10s, expiration).
  • Platform coverageshouldAnnounceOnNative: true + shouldAnnounceOnWeb: true ensures all platforms are covered.
  • Timing is correct — The timeRemaining === 1 check for expiration is necessary since onCountdownFinish() sets isCountdownRunning = false, which unmounts the component at timeRemaining === 0. The 300ms web announcement delay still completes before the 1s timer tick, so the announcement is spoken before unmount.
  • Reset behavior works — When resetCountdown sets timeRemaining back to 30, the hook's dedup refs (previousAnnouncedMessageRef on native, prevShouldAnnounceRef on web) are reset when shouldAnnounceMessage goes false (30 % 10 !== 1), so subsequent announcements at 21/11/1 fire correctly.
  • Comments explain the magic numbers well.

Minor observations (non-blocking)

  1. Singular plural forms are dead code in practice — The timeRemaining === 1 ? 'second' : 'seconds' branch in translations will never trigger for the time-remaining announcement since the only values passed are 20 and 10. This is fine as defensive programming, but worth being aware of.

  2. Polish pluralization is simplified — Polish has 3 plural forms (sekunda/sekundy/sekund), but the translation only handles 2. This happens to be correct for values 10 and 20 (both use "sekund"), so it works for the current use case.

  3. No unit tests — Neither ValidateCodeCountdown nor useAccessibilityAnnouncement have test files. Consider adding a test that verifies the announcement fires at the correct timeRemaining values (21, 11, 1) and not at others, especially to guard the timeRemaining - 1 offset logic.

Verdict

The implementation is correct and minimal. The hook behavior is sound across all platforms, edge cases (reset, unmount timing) are handled, and all language files are updated consistently. The observations above are non-blocking.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd5ccf3c1b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +35 to +36
timeRemaining === 1 ? translate('validateCodeForm.timeExpiredAnnouncement') : translate('validateCodeForm.timeRemainingAnnouncement', {timeRemaining: timeRemaining - 1}),
timeRemaining % 10 === 1,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Announce countdown value at the actual remaining second

The new announcement logic subtracts one from timeRemaining and triggers on timeRemaining % 10 === 1, so users hear 20 while the UI still shows 21, 10 while it shows 11, and even "time expired" while 1 second is still left. This creates a consistent off-by-one mismatch between what screen reader users hear and what the timer actually represents, which is especially confusing near expiry.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine. While saying "Time remaining:", 1 second is gone already.

Copy link
Contributor

@trjExpensify trjExpensify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessibility project PR 👍

@youssef-lr
Copy link
Contributor

Re-running reassure

@MelvinBot
Copy link
Contributor Author

The failing perf-tests check is unrelated to this PR.

Analysis: The failure is in useAdvancedSearchFilters hook initial render with policies — a render count deviation of 0.8 exceeded the allowed deviation of 0. This PR only modifies ValidateCodeCountdown and language translation files, which have no connection to the advanced search filters hook.

Evidence: Files changed in this PR: ValidateCodeCountdown/index.tsx and src/languages/*.ts. The failing test is about useAdvancedSearchFilters, a completely different subsystem.

@situchan
Copy link
Contributor

@MelvinBot pull main

…Accessibility

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner March 21, 2026 01:06
@melvin-bot melvin-bot bot requested review from situchan and removed request for a team March 21, 2026 01:06
@melvin-bot
Copy link

melvin-bot bot commented Mar 21, 2026

@situchan Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot
Copy link
Contributor Author

Merged main into this branch successfully. ✅

@MelvinBot
Copy link
Contributor Author

The failing check is unrelated to this PR.

Failing check: build (New Expensify Dev, DebugDevelopment, false) — iOS build

Analysis: The build fails with Swift compiler errors in ios/AppDelegate.swift:

error: ambiguous implicit access level for import of 'Expo'; it is imported as 'internal' elsewhere
error: ambiguous implicit access level for import of 'ExpoModulesCore'; it is imported as 'internal' elsewhere

Evidence: This PR only modifies TypeScript/translation files:

  • src/components/ValidateCodeCountdown/index.tsx
  • src/languages/*.ts (translation files)

None of the changed files touch iOS native code. The Swift import access level error in AppDelegate.swift is a pre-existing build environment issue unrelated to these changes.

@youssef-lr
Copy link
Contributor

@MelvinBot can you merge main

…Accessibility

Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
@MelvinBot
Copy link
Contributor Author

Merged main into this branch successfully. ✅

@carlosmiceli carlosmiceli merged commit 93a65ac into main Mar 23, 2026
35 checks passed
@carlosmiceli carlosmiceli deleted the claude-timerCountdownAccessibility branch March 23, 2026 14:26
@github-actions
Copy link
Contributor

🚧 @carlosmiceli has triggered a test Expensify/App build. You can view the workflow run here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants