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

[useAutocomplete] Fix useAutocomplete disabled prop not disabling the input #36076

Merged
merged 2 commits into from
Feb 13, 2023

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented Feb 6, 2023

@mui-bot
Copy link

mui-bot commented Feb 6, 2023

Messages
📖 Netlify deploy preview: https://deploy-preview-36076--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against 5a53afd

@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Feb 6, 2023
@napewnoarnold
Copy link

@sai6855 note that if disabled option is set dynamically, for example if the user has a button that disables/enables useAutocomplete component this solution will not fix click away listener problem.

disable hook -> trigger onMouseDown on input -> enable component -> popper stays open even if user clicks away

@sai6855
Copy link
Contributor Author

sai6855 commented Feb 7, 2023

@sai6855 note that if disabled option is set dynamically, for example if the user has a button that disables/enables useAutocomplete component this solution will not fix click away listener problem.

disable hook -> trigger onMouseDown on input -> enable component -> popper stays open even if user clicks away

can you provide a sandbox with the issue you described?

you can use this template https://codesandbox.io/s/huxjvu?file=/demo.tsx

@ZeeshanTamboli ZeeshanTamboli added the bug 🐛 Something doesn't work label Feb 10, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [useAutocomplete] Add disabled key to return value of getInputProps [useAutocomplete] Fix useAutocomplete disabled prop does not disable component Feb 10, 2023
@ZeeshanTamboli ZeeshanTamboli added the package: base-ui Specific to @mui/base label Feb 10, 2023
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@ZeeshanTamboli
Copy link
Member

@sai6855 note that if disabled option is set dynamically, for example if the user has a button that disables/enables useAutocomplete component this solution will not fix click away listener problem.

disable hook -> trigger onMouseDown on input -> enable component -> popper stays open even if user clicks away

@arnoldkokot It is not related to this bug or PR. Please create a new issue showing a reproduction if it's a bug.

@michaldudak michaldudak changed the title [useAutocomplete] Fix useAutocomplete disabled prop does not disable component [useAutocomplete] Fix useAutocomplete disabled prop not disabling the input Feb 13, 2023
@michaldudak michaldudak merged commit 7728464 into mui:master Feb 13, 2023
@sai6855 sai6855 deleted the use-autocomplete-disable branch August 22, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useAutocomplete disabled prop does not disable component
6 participants