Repository navigation
[select][combobox] Do not trigger Field onBlur handlers when opening popup - #3609
Merged
Merged
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
atomiks
force-pushed
the
fix/test-select-act-warnings
branch
2 times, most recently
from
December 24, 2025 08:27
530e23f to
f9222e8
Compare
onBlur handlers when opening popup
atomiks
marked this pull request as ready for review
December 24, 2025 08:31
mnajdova
reviewed
Dec 24, 2025
mnajdova
left a comment
Member
There was a problem hiding this comment.
Looks good, let's add test, unless some commits are missing :)
atomiks
force-pushed
the
fix/test-select-act-warnings
branch
2 times, most recently
from
December 29, 2025 05:55
01f7837 to
a0e5e83
Compare
michaldudak
approved these changes
Jan 14, 2026
atomiks
force-pushed
the
fix/test-select-act-warnings
branch
from
January 14, 2026 09:26
4aafa25 to
2b9afda
Compare
onBlur handlers when opening popuponBlur handlers when opening popup
atomiks
force-pushed
the
fix/test-select-act-warnings
branch
from
January 14, 2026 09:27
2b9afda to
fbd4c6f
Compare
Contributor
Author
Contributor
Greptile SummaryThis PR prevents Field Changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Trigger
participant Field
participant Popup
participant FloatingUI
Note over User,FloatingUI: Before this PR (incorrect behavior)
User->>Trigger: Click to open
Trigger->>Field: onFocus
Field->>Field: setFocused(true)
Trigger->>FloatingUI: Request open popup
FloatingUI-->>Popup: Open popup
FloatingUI->>Popup: enqueueFocus (async)
Trigger->>Field: onBlur (relatedTarget: popup)
Field->>Field: setTouched(true), setFocused(false)
Field->>Field: Validate (onBlur mode) ❌
Note right of Field: Wrong! Should not validate yet
Note over User,FloatingUI: After this PR (correct behavior)
User->>Trigger: Click to open
Trigger->>Field: onFocus
Field->>Field: setFocused(true)
Trigger->>FloatingUI: Request open popup
FloatingUI-->>Popup: Open popup
FloatingUI->>Popup: enqueueFocus (async)
Trigger->>Trigger: onBlur (relatedTarget: popup)
Trigger->>Trigger: Check contains(popup, relatedTarget) ✓
Note right of Trigger: Skip Field blur - still in component
Note over User,FloatingUI: Closing popup by clicking outside
User->>User: Click outside element
Popup->>FloatingUI: Detect outside press
FloatingUI->>Popup: setOpen(false, reason: outsidePress)
Popup->>Field: setTouched(true), setFocused(false)
Field->>Field: Validate (onBlur mode) ✓
Note right of Field: Correct! Now validates
|
atomiks
force-pushed
the
fix/test-select-act-warnings
branch
from
January 14, 2026 10:57
fbd4c6f to
346ba82
Compare
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.
focused/touchedstates/onBlurvalidation shouldn't run when e.g. clicking the trigger and focus moves into the popup. In that caseonBlurruns, but it should really only run when blur leaves the trigger not as the result of opening the popup.This also addresses
act()warnings, sinceenqueueFocusinFloatingFocusManageris (intentionally) async: clicking the trigger causes focus to move into the popup async, which then firesonBlur, causing the state updates to happen outsideact(...)