Repository navigation
fix: prevent selection when an open dropdown is disabled - #4548
Open
Xapollon430 wants to merge 1 commit into
Open
Xapollon430 wants to merge 1 commit into
Xapollon430 wants to merge 1 commit into
Conversation
|
@Xapollon430 is attempting to deploy a commit to the Semantic UI Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4548 +/- ##
=======================================
Coverage 99.53% 99.53%
=======================================
Files 186 186
Lines 3463 3463
=======================================
Hits 3447 3447
Misses 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Xapollon430
marked this pull request as ready for review
November 2, 2026 03:19
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
I was playing around with the
Dropdowncomponent and noticed a bug where:disabledtotruewhile the menu is open.onChangestill fires.Here is a reproduction video of the issue:
Recorded against published Semantic UI React 2.1.5, before the fix.
semantic-ui-react-disabled-repro.mp4
A React re-render can send
disabled=trueafter 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
selectin Chromium. The HTML option-picking algorithm also stops without selecting an option when its select is disabled.Semantic UI React supports a controlled
openprop. If the application keepsopen={true}, closing the popup internally can disagree with the state the application supplied. I personally prefer keeping the menu visible and preventing selection in that case. Closing on disable is also a reasonable choice, and I'm happy to follow the library's preferred pattern; we just need to account for that controlled open state.The options inherit the Dropdown's disabled state, and the keyboard selection path checks it too. The current open state is preserved.
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
The reproduced release is 2.1.5, while this branch targets the current
mastersource.