Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultIsOpen feature does not work when combined with closeOnChangedValue #718

Open
BentleyDavis opened this issue Nov 10, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@BentleyDavis
Copy link

Description the bug
defaultIsOpen feature does not work when combined with closeOnChangedValue

Sandbox / Git Repo
https://codesandbox.io/s/defaultisopen-and-closeonchangedvalue-q4mrsd

To Reproduce
Steps to reproduce the behavior:

  1. Set the option defaultIsOpen={true}
  2. Render and see it open automatically
  3. Set the options closeOnChangedValue={true}
  4. Render and see it no longer opens automatically

Expected behavior
The select should stay open until acted on. It opens then quickly shuts before the user can get to it.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Brave
  • Version: v1.60.114

Smartphone (please complete the following information):
N/A

Additional context
Looks like in dropdown.tsx line 35 the useEffect closes the select on all renders including the first.

useEffect(() => {
    if (closeOnChangedValue) {
      setExpanded(false);
    }
  }, [value]);
@BentleyDavis BentleyDavis added the bug Something isn't working label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant