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

issue: Form-level disabled doesn't affect uncontrolled inputs that aren't rendered immediately #12021

Open
1 task done
amitdahan opened this issue Jun 16, 2024 · 1 comment · May be fixed by #12022
Open
1 task done

Comments

@amitdahan
Copy link

amitdahan commented Jun 16, 2024

Version Number

7.51.5

Codesandbox/Expo snack

https://codesandbox.io/p/sandbox/white-glitter-lqhxg3

Steps to reproduce

  1. Visit the repro (https://codesandbox.io/p/sandbox/white-glitter-lqhxg3)
  2. Only the controlled input is disabled

image

Expected behaviour

Both fields are disabled

Code of Conduct

  • I agree to follow this project's Code of Conduct
@amitdahan
Copy link
Author

From what I can understand, the issue is due to the following useEffect only relying on useForm's disabled field to re-set the disabled field on the currently-registered inputs:

React.useEffect(
() => control._disableForm(props.disabled),
[control, props.disabled],
);

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