components icon indicating copy to clipboard operation
components copied to clipboard

fix: Highlight the first select option by default if none are selected

Open avinashbot opened this issue 7 months ago • 1 comments

Description

NVDA borks if there's no aria-activedescendant on a focused listbox. So we select the first one by default.

Had to modify a bunch of tests because of the "screen reader text" internal implementation logic that leads to .textContent being duplicated. Thankfully .toHaveTextContent() seems to be immune to that, so I just switched to that instead.

Related links, issue #, if available: AWSUI-60825

How has this been tested?

Fought and defeated the unit tests.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

avinashbot avatar Jun 02 '25 09:06 avinashbot

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.58%. Comparing base (bdfe392) to head (2ed951c). Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3546      +/-   ##
==========================================
+ Coverage   96.55%   96.58%   +0.03%     
==========================================
  Files         804      807       +3     
  Lines       23439    23483      +44     
  Branches     7753     8191     +438     
==========================================
+ Hits        22631    22681      +50     
+ Misses        801      748      -53     
- Partials        7       54      +47     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 03 '25 15:06 codecov[bot]