Skip to content

Conversation

pan-kot
Copy link
Member

@pan-kot pan-kot commented Sep 5, 2025

Description

This fixes failing autosuggest tests with React 18, reproducible here: #3829

Rel: AWSUI-61204

How has this been tested?

  • I run the related integ tests for autosuggest and select a few dozen times locally and got no failures
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.

@pan-kot pan-kot marked this pull request as ready for review September 5, 2025 06:54
@pan-kot pan-kot requested a review from a team as a code owner September 5, 2025 06:54
@pan-kot pan-kot requested review from just-boris and removed request for a team September 5, 2025 06:54
@pan-kot pan-kot enabled auto-merge September 5, 2025 06:54
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (746aab5) to head (17a7dfe).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3842      +/-   ##
==========================================
- Coverage   97.14%   97.12%   -0.02%     
==========================================
  Files         844      844              
  Lines       24505    24553      +48     
  Branches     8647     8659      +12     
==========================================
+ Hits        23805    23848      +43     
- Misses        693      698       +5     
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

items,
hasNextPage
);
await this.pause(10);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this happening?

Copy link
Member Author

Choose a reason for hiding this comment

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

Here is what I observed. I this test:

test(
  'the bottom of the dropdown lines up with the highlighted option, when going down the list',
  setup({ virtualScrolling }, async page => {
    await page.respondWith(0, true);
    await page.keys(['ArrowDown', 'ArrowDown', 'ArrowDown']);
    const { bottom: optionBottom } = await page.getHighlightedPosition();
    const { bottom: dropdownBottom } = await page.getDropdownPosition();
    // a small give for borders and negative margins
    expect(Math.abs(optionBottom - dropdownBottom)).toBeLessThan(3);
  })
);

we issue 3 keydown events. However, only two keydown events are received (sometimes, it is flaky).

Screenshot 2025-09-10 at 14 41 50

I think there is a chance that the key-down handler is called before the options are ready, in which case the 1st keydown is just ignored. Adding a small delay fixes the problem.

Copy link
Member

Choose a reason for hiding this comment

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

@pan-kot pan-kot disabled auto-merge September 10, 2025 12:24
@pan-kot pan-kot requested a review from just-boris September 10, 2025 12:52
@pan-kot pan-kot added this pull request to the merge queue Sep 11, 2025
Merged via the queue into main with commit f2d96fb Sep 11, 2025
89 of 96 checks passed
@pan-kot pan-kot deleted the chore-fix-virtual-dropdown-test-react18 branch September 11, 2025 08:04
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.

3 participants