Description
Description:
After upgrading to coreui-react
v5.6.0, the dropdown component rerenders whenever an input inside the dropdown is changed (e.g., typing in a text field).
It seems related to this change:
v5.5.0...v5.6.0#diff-2d524df48f938b94012faeccfcd7c2d5ad4d297e1b3f46a9357eee1fb68747b1R241-R279
That change adds more dependencies to the useEffect
. When inputs inside the dropdown change, new references are created and the effect re-runs, which triggers the cleanup function. This destroys the popper instance, calls onHide
, and removes event listeners — effectively rerendering the dropdown.
Repro link:
https://codesandbox.io/p/devbox/intelligent-lehmann-r5z5y8?workspaceId=ws_DikbXRwHoGrNt9M6NXuZNR
Steps to reproduce:
- Open the repro sandbox.
- Click the dropdown to open it.
- Type into the input field inside the dropdown.
- Notice the dropdown rerenders and the input loses focus.
Expected behavior:
Typing into an input inside the dropdown should not cause the dropdown to rerender or close, and the input should retain focus.