Skip to content

fix: Ignore select options while disabled - #5232

Open
Xapollon430 wants to merge 1 commit into
cloudscape-design:mainfrom
Xapollon430:codex/select-disabled-after-open
Open

Xapollon430 wants to merge 1 commit into
cloudscape-design:mainfrom
Xapollon430:codex/select-disabled-after-open

Conversation

@Xapollon430

@Xapollon430 Xapollon430 commented Nov 3, 2026 •

Copy link
Copy Markdown

Fixes #5231.

Problem

I was playing around with the Select component and noticed a bug where:

  1. Open an enabled Select.
  2. Set disabled to true while the menu is open.
  3. Click an option. The selection changes and onChange still fires.

Here is a reproduction video of the issue:

Recorded against @cloudscape-design/components 3.0.1408. Runnable reproduction includes the required styles and setup.

cloudscape-disabled-repro.mp4

A React re-render can send disabled=true after the menu is already open. In an application, that could happen when an asynchronous request completes or a timer fires while someone is choosing an option. The case here is the parent control becoming disabled; the options haven't been individually marked disabled.

My first thought was to close the popup, since that is what I observed with a native HTML select in Chromium. The HTML option-picking algorithm also stops without selecting an option when its select is disabled.

Closing on disable is a reasonable choice too. I'm happy to adjust the PR to follow the library's preferred behavior. The behavior I'm trying to guarantee is simply that a control stops accepting user selections once it becomes disabled.

This change checks the current disabled state before emitting a selection change from the open dropdown. It keeps the existing popup behavior.

I started investigating this interaction while using Hegel to vary component props and Bombadil to exercise UI actions in Anta. I then reproduced this library's behavior separately; the video above is from that reproduction.

Validation

248 Select tests pass across 16 suites; the full production build, full ESLint/stylelint, and scoped formatting pass. The regression covers both expandToViewport modes using the official test utilities. The new regression fails without the fix.

AI-assisted implementation and testing.


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

Reject user selection after the parent becomes disabled while its menu is open.

Signed-off-by: Vehbi Karaagac <Xapollon430@gmail.com>
@Xapollon430
Xapollon430 requested a review from a team as a code owner November 3, 2026 05:32
@Xapollon430
Xapollon430 requested review from georgylobko and removed request for a team November 3, 2026 05:32

This branch has not been deployed

No deployments
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.

Select accepts selection after becoming disabled while open

1 participant