Skip to content

Conversation

@mindtraveller
Copy link

What:

This is a fix which I discovered while upgrading to React v19, but it's for sure applicable to any version of React.

Why:

The issue is: the downshift elements from refs were accessed in the main scope of the effect callback inside useMouseAndTouchTracker, which saves the version of the elements at the moment of the initialization of that effect. Since those are the refs, they can be updated at any point without causing re-rendering which leads to incorrect values being used in the event handlers (mouse up etc.).

How:

The fix is quite simple - read the elements from refs at the moment of the event to make sure we always get the actual values.

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

@mindtraveller
Copy link
Author

mindtraveller commented Oct 9, 2025

Hey @silviuaavram,

I would appreciate if you can review the fix and release it. It is critical for React v19 support as the Combobox will work incorrectly otherwise.

Let me know if any changes are required

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.

1 participant