Skip to content

Implement accessibility changes for search suggestions#85296

Open
ShridharGoel wants to merge 15 commits intoExpensify:mainfrom
ShridharGoel:accessibility77390
Open

Implement accessibility changes for search suggestions#85296
ShridharGoel wants to merge 15 commits intoExpensify:mainfrom
ShridharGoel:accessibility77390

Conversation

@ShridharGoel
Copy link
Contributor

@ShridharGoel ShridharGoel commented Mar 14, 2026

Explanation of Change

Implement accessibility changes for suggestions

Fixed Issues

$ #77390
PROPOSAL:

Tests

Precondition: User is logged in

  1. Using VoiceOver on iOS or TalkBack on Android, open the app
  2. Swipe right to focus the Account tab and double-tap to activate it
  3. Swipe right to focus the Profile button and double-tap to activate it
  4. Swipe right to focus the Status menu item and double-tap to activate it
  5. Swipe right to focus the Vacation delegate menu item and double-tap to activate it
  6. Note if the available list of suggestions is announced
  7. Swipe right to focus the text field and enter any search query
  8. After loading is complete, note if the search result suggestions are announced
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests.

  • 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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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
Screen.Recording.2026-03-17.at.12.50.20.AM.mov
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari Screenshot 2026-03-17 at 1 24 54 AM

@melvin-bot
Copy link

melvin-bot bot commented Mar 14, 2026

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

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

Files with missing lines Coverage Δ
...ListWithSections/BaseSelectionListWithSections.tsx 93.90% <ø> (ø)
.../components/SelectionList/components/TextInput.tsx 100.00% <100.00%> (ø)
src/components/Search/SearchAutocompleteList.tsx 73.78% <70.00%> (+2.02%) ⬆️
... and 9 files with indirect coverage changes

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 14, 2026

@ShridharGoel can you borrow stuff from here - https://github.com/Expensify/App/pull/85166/changes

Feels like a lot of overlap in functions. Eg: the hook useAccessibilityAnnouncement

Wdyt? we'll resolve conflicts if they happen

@rushatgabhane
Copy link
Member

cc @Krishna2323 if you can advise us here

@rushatgabhane
Copy link
Member

@MelvinBot suggest changes #85296 (comment)

@MelvinBot
Copy link
Contributor

@rushatgabhane @ShridharGoel — Good catch, there is significant overlap between this PR and #85166. Here's a detailed breakdown and suggestions:

Overlap Summary

Both PRs implement accessibility announcements for screen readers, but they take different architectural approaches:

Concern PR #85166 (Krishna2323) PR #85296 (this PR)
Approach Reusable hook (useDebouncedAccessibilityAnnouncement) Component-based (SuggestionsAvailabilityAnnouncement + 3 platform helpers)
Debouncing useDebouncedValue hook + debounced announcement hook Manual timeout + lastAnnouncementRef dedup in component
Web announcement Enhances existing useAccessibilityAnnouncement (hidden aria-live div) Hidden <Text accessibilityLiveRegion="polite"> component
iOS announcement AccessibilityInfo.announceForAccessibility (via existing hook) AccessibilityInfo.announceForAccessibility (via platform helper)
Android announcement AccessibilityInfo.announceForAccessibility (via existing hook) Clear-then-set live region text with 50ms delay
"No results" announcements Yes (many pages: AddressSearch, EmojiPicker, SearchBar, TextInput, SelectionList, TableBody, WorkspaceWorkflows) No
"Suggestions available" announcements No Yes (SearchAutocompleteList, TextInput, BaseSelectionListWithSections)

Specific Suggestions

1. Reuse useDebouncedAccessibilityAnnouncement instead of SuggestionsAvailabilityAnnouncement

The new SuggestionsAvailabilityAnnouncement component (83 lines) + 3 platform helper files (37 lines) essentially reimplement what useDebouncedAccessibilityAnnouncement from #85166 already does. The hook approach is lighter and more composable:

// Instead of the SuggestionsAvailabilityAnnouncement component, you could do:
const suggestionsAnnouncement = suggestionsCount > 0
    ? translate('search.suggestionsAvailable', {count: suggestionsCount}, query)
    : '';
useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, suggestionsCount > 0, searchValue);

This would eliminate 4 new files:

  • SuggestionsAvailabilityAnnouncement.tsx
  • SuggestionsAvailabilityAnnouncementHelper.ts
  • SuggestionsAvailabilityAnnouncementHelper.android.ts
  • SuggestionsAvailabilityAnnouncementHelper.ios.ts

2. Coordinate on shared files

Both PRs modify these files and will conflict:

If this PR adopts the hook from #85166, the modifications to these files become additive rather than conflicting.

3. Keep what's unique to this PR

This PR does add value beyond #85166:

  • "Suggestions available" announcements — announcing the count of suggestions as the user types in search, which fix: Screen Readers: Many Pages: The status message of no results is not announced. #85166 doesn't cover
  • suggestionsAvailable translation key — the new localized string for suggestion count announcements
  • useMemo for sections in SearchAutocompleteList — performance improvement wrapping sections generation
  • dataLengthitemsCount fix in BaseSelectionListWithSections — corrects what gets passed to TextInput

4. Consider aria-hidden on visible text

PR #85166 adds aria-hidden to visible "no results" text elements to prevent screen readers from reading both the visible text AND the programmatic announcement. This PR should consider the same pattern for consistency, especially if the suggestions count is displayed visually anywhere.

Recommended Path Forward

  1. Wait for or coordinate with fix: Screen Readers: Many Pages: The status message of no results is not announced. #85166 to land first (it's more foundational — enhances core hooks used across many pages)
  2. Rebase this PR on top of it
  3. Replace the SuggestionsAvailabilityAnnouncement component with calls to useDebouncedAccessibilityAnnouncement
  4. Keep the unique parts: suggestionsAvailable translations, useMemo sections optimization, suggestion counting logic

This would significantly reduce the diff size and avoid maintaining two parallel announcement systems.

@ShridharGoel
Copy link
Contributor Author

@rushatgabhane So should we hold one till the other is done?

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 14, 2026

@ShridharGoel no we don't need to hold

You can use that PR as the base and build on top of it and sync it if there are changes

@rushatgabhane
Copy link
Member

or you can copy paste relevant stuff if that is simpler

@ShridharGoel ShridharGoel marked this pull request as ready for review March 16, 2026 19:58
@ShridharGoel ShridharGoel requested review from a team as code owners March 16, 2026 19:58
@melvin-bot melvin-bot bot requested review from aimane-chnaif and removed request for a team March 16, 2026 19:58
@melvin-bot
Copy link

melvin-bot bot commented Mar 16, 2026

@aimane-chnaif 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 heyjennahay and removed request for a team March 16, 2026 19:58
@ShridharGoel
Copy link
Contributor Author

Will need help from someone with a physical iPhone to test on iOS.

@aimane-chnaif
Copy link
Contributor

Will need help from someone with a physical iPhone to test on iOS.

I have physical iPhone to test

return {sections: nextSections, styledRecentReports: nextStyledRecentReports};
}, [autocompleteQueryValue, autocompleteSuggestions, expensifyIcons, getAdditionalSections, recentReportsOptions, recentSearchesData, searchOptions, searchQueryItem, styles, translate]);

const sectionItemText = sections?.at(1)?.data?.[0]?.text ?? '';
Copy link
Contributor

Choose a reason for hiding this comment

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

❌ CLEAN-REACT-PATTERNS-0 (docs)

React Compiler is enabled and will automatically memoize this pure computation. firstRecentReportFlatIndex is derived from firstRecentReportKey and sections with no side effects -- the compiler handles this without manual useMemo.

Remove the useMemo and compute the value directly:

let firstRecentReportFlatIndex = -1;
if (firstRecentReportKey) {
    let flatIndex = 0;
    for (const section of sections) {
        // ... existing iteration logic ...
    }
}

Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

const timeout = setTimeout(() => {
setLiveRegionAnnouncement(announcement);
setAnnouncementTimeout(null);
}, 50);
Copy link
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-2 (docs)

The value 50 is a magic number used as a setTimeout delay for TalkBack live region updates. While the comment above explains the general strategy, the numeric value should be extracted into a named constant for readability and maintainability.

Extract it into a named constant:

const TALKBACK_LIVE_REGION_UPDATE_DELAY_MS = 50;

// Then use:
}, TALKBACK_LIVE_REGION_UPDATE_DELAY_MS);

Consider also adding it to CONST.TIMING if it may be reused elsewhere.


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

@aimane-chnaif
Copy link
Contributor

Please fix conflict

…ility77390

# Conflicts:
#	Mobile-Expensify
#	src/components/SelectionList/components/TextInput.tsx
#	src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx
#	src/hooks/useAccessibilityAnnouncement/index.ts
#	src/hooks/useDebouncedAccessibilityAnnouncement.ts
#	src/hooks/useDebouncedValue.ts
Comment on lines +418 to +421
const suggestionsCount = sections.reduce((total, section) => total + section.data.filter((item) => item.searchItemType !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM).length, 0);
const trimmedAutocompleteQueryValue = autocompleteQueryValue.trim();
const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue || undefined) : '';
useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, !!suggestionsAnnouncement, autocompleteQueryValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

For this component, we only need this change and others are just refactor right? And what's the refactor for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the sections block was moved into useMemo at SearchAutocompleteList.
Because sections, styledRecentReports, and now suggestionsCount are all derived from the same inputs. This groups that derived work in one place instead of rebuilding pieces separately.


const sectionItemText = sections?.at(1)?.data?.[0]?.text ?? '';
const normalizedReferenceText = sectionItemText.toLowerCase();
const suggestionsCount = sections.reduce((total, section) => total + section.data.filter((item) => item.searchItemType !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM).length, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Calculate count when data is pushed to sections. No need to iterate separately.

i.e.
let suggestionsCount = 0;
...
suggestionsCount += recentSearchesData.length;
sections.push({title, data: recentSearchesData})
...

const normalizedReferenceText = sectionItemText.toLowerCase();
const suggestionsCount = sections.reduce((total, section) => total + section.data.filter((item) => item.searchItemType !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM).length, 0);
const trimmedAutocompleteQueryValue = autocompleteQueryValue.trim();
const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue || undefined) : '';
Copy link
Contributor

Choose a reason for hiding this comment

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

Use one/other approach for singular/plural copy.
|| undefined is redundant

const suggestionsCount = sections.reduce((total, section) => total + section.data.filter((item) => item.searchItemType !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM).length, 0);
const trimmedAutocompleteQueryValue = autocompleteQueryValue.trim();
const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue || undefined) : '';
useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, !!suggestionsAnnouncement, autocompleteQueryValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should 3rd param be trimmedAutocompleteQueryValue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That third param is only used as the debounce signal in useDebouncedAccessibilityAnnouncement, so using autocompleteQueryValue makes whitespace edits reset the timer too. The announcement text itself already uses the trimmed value.

options={textInputOptions}
onSubmit={selectFocusedItem}
dataLength={flattenedData.length}
dataLength={itemsCount}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this change for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to keep the announced count aligned with actual suggestion rows. flattenedData.length includes section headers, while itemsCount only counts real items, so dataLength={itemsCount} avoids overcounting when headers are present.

@aimane-chnaif
Copy link
Contributor

aimane-chnaif 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
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari searchautocompletelist selectionlist selectionlistwithsections

const normalizedReferenceText = sectionItemText.toLowerCase();
const trimmedAutocompleteQueryValue = autocompleteQueryValue.trim();
const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue) : '';
useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, !!suggestionsAnnouncement, autocompleteQueryValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

No announcement on search router. Works fine on Report search though

Image

const normalizedReferenceText = sectionItemText.toLowerCase();
const trimmedAutocompleteQueryValue = autocompleteQueryValue.trim();
const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue) : '';
useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, !!suggestionsAnnouncement, autocompleteQueryValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no announcement when no results found. Should we also fix this or out of scope?

Copy link
Member

@rushatgabhane rushatgabhane Mar 19, 2026

Choose a reason for hiding this comment

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

I'm pretty sure we fixed this on main, let's not undo that

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure we fixed this on main, let's not undo that

Which PR?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@aimane-chnaif aimane-chnaif Mar 19, 2026

Choose a reason for hiding this comment

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

This page is a bit different. This search is using separate input, not part of SelectionListWithSections

search

And even though no results found, there's always item to be clickable. Not sure what to announce in this case.

Copy link
Member

Choose a reason for hiding this comment

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

This will fix it btw, feel free to implement if you want

 const suggestionsAnnouncement = suggestionsCount > 0 ? translate('search.suggestionsAvailable', {count: suggestionsCount}, trimmedAutocompleteQueryValue) : '';
 useDebouncedAccessibilityAnnouncement(suggestionsAnnouncement, !!suggestionsAnnouncement, autocompleteQueryValue);
+
+const noResultsFoundText = translate('common.noResultsFound');
+const shouldAnnounceNoResults = suggestionsCount === 0 && !!trimmedAutocompleteQueryValue;
+useDebouncedAccessibilityAnnouncement(noResultsFoundText, shouldAnnounceNoResults, autocompleteQueryValue);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated (with isLoading check as well since it shouldn't be announced when results are loading)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aimane-chnaif Can you verify?

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified

@aimane-chnaif
Copy link
Contributor

There's issue on search router. Otherwise looks good.

@ShridharGoel
Copy link
Contributor Author

ShridharGoel commented Mar 19, 2026

@aimane-chnaif Seems to be working fine. I think in your video, there are no search results, hence no announcement.

Screen.Recording.2026-03-20.at.2.44.01.AM.mov

@aimane-chnaif
Copy link
Contributor

Still not working. Can you test again after merge main? I merged main locally since the branch is very behind.

bug.mov

@ShridharGoel
Copy link
Contributor Author

Just tried after pulling latest main. Can you check once by waiting a few seconds after the loading is complete before changing the query?

Screen.Recording.2026-03-20.at.2.56.52.AM.mov

@aimane-chnaif
Copy link
Contributor

Just tried after pulling latest main. Can you check once by waiting a few seconds after the loading is complete before changing the query?

Screen.Recording.2026-03-20.at.2.56.52.AM.mov

Still not working for me. Let's test in adhoc build

@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 #77390 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 tylerkaraszewski March 19, 2026 21:41
@github-actions
Copy link
Contributor

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

@aimane-chnaif
Copy link
Contributor

Just tested adhoc build. MacOS VoiceOver, Google Chrome
@ShridharGoel Still no announcement in search router, while works in reports search.

@ShridharGoel
Copy link
Contributor Author

Still working for me. Maybe we can get it QA tested.

Screen.Recording.2026-03-21.at.1.10.09.AM.mov

@rushatgabhane
Copy link
Member

@ShridharGoel bump

@aimane-chnaif
Copy link
Contributor

@rushatgabhane can we ask QA (or you) to test this page on MacOS VoiceOver?
I reproduced on my browser but not on @ShridharGoel's.
Otherwise looks good.

@rushatgabhane
Copy link
Member

yep on Chrome macos it doesn't workl

image

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.

4 participants