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

Autocomplete Input uses readOnlyProp as disabled #9981

Closed
igor-adzz opened this issue Jul 9, 2024 · 3 comments
Closed

Autocomplete Input uses readOnlyProp as disabled #9981

igor-adzz opened this issue Jul 9, 2024 · 3 comments

Comments

@igor-adzz
Copy link

What you were expecting:
I'm expecting to use AutocompleteInput with readOnly prop and close this input for edit.

What happened instead:
Instead of this AutocompleteInput uses disabled

Related code:
image

  • React-admin version: 5.0.3
@slax57
Copy link
Contributor

slax57 commented Jul 9, 2024

Thank you for your report.

This code was introduced as a way to solve an issue in the way react-hook-form deals with disabled inputs.
See #9656 for more info.

If my recollection is good, MUI's Autocomplete does not have a readOnly prop. Hence, we had to hook it to the disabled prop.

Can you elaborate on why this is causing an issue for you?
Thanks.

@slax57
Copy link
Contributor

slax57 commented Jul 9, 2024

Alternatively, you can also try passing props directly to the underlying TextField.

For example:

                <AutocompleteInput
                    optionText="name"
                    fullWidth
                    TextFieldProps={{ InputProps: { disabled: true } }}
                />

@fzaninotto
Copy link
Member

No news for some time, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants