Skip to content

Conversation

@SpyZzey
Copy link
Member

@SpyZzey SpyZzey commented Nov 14, 2025

Description

This PR fixes a bug that groups "root"-level options in a select and multiselect dropdown to the previous group. The issue was non-visual, but leads to issues with accessibility screen readers.

  • Added Tests
  • Removed a condition in "unflatten-options" that wrongly grouped "non"-child elements to the previous group.

Related Issues: [AWSUI-61453]

How has this been tested?

  • Added unit tests to test the unflattenOptions function.
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.

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.99%. Comparing base (abb494e) to head (ce9c3db).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4038   +/-   ##
=======================================
  Coverage   96.99%   96.99%           
=======================================
  Files         861      861           
  Lines       25207    25207           
  Branches     9098     9097    -1     
=======================================
  Hits        24450    24450           
- Misses        710      751   +41     
+ Partials       47        6   -41     

☔ 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.

@SpyZzey SpyZzey marked this pull request as ready for review November 17, 2025 09:47
@SpyZzey SpyZzey requested a review from a team as a code owner November 17, 2025 09:47
@SpyZzey SpyZzey requested review from ernst-dev and jperals and removed request for a team and ernst-dev November 17, 2025 09:47
currentParent = wrapped;
nestedOptions.push(wrapped);
} else if (!option.type || option.type === 'child') {
} else if (option.type === 'child') {
Copy link
Member

Choose a reason for hiding this comment

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

What is the case for the option.type to be undefined?

Copy link
Member

Choose a reason for hiding this comment

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

Assuming that root-level non-parent nodes have option.type set to undefined, I think this can be on the right direction, and simpler than my approach.

Could you add some testing coverage?

Copy link
Member Author

@SpyZzey SpyZzey Nov 17, 2025

Choose a reason for hiding this comment

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

What is the case for the option.type to be undefined?

@pan-kot
In the flatten-options.ts, the option.type = "child" will be set, if the option is inside the options array of another parent-option (e.g. groups). The parent-option will get the option.type = "parent" set.

@jperals Exactly. I will add some test cases.

@SpyZzey SpyZzey force-pushed the fix/dropdown-incorrect-grouping branch from 5835cab to ce9c3db Compare November 19, 2025 09:54
@SpyZzey SpyZzey added this pull request to the merge queue Nov 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2025
@jperals jperals added this pull request to the merge queue Nov 19, 2025
Merged via the queue into main with commit f417b34 Nov 19, 2025
49 checks passed
@jperals jperals deleted the fix/dropdown-incorrect-grouping branch November 19, 2025 11:11
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