react-jsonschema-form
react-jsonschema-form copied to clipboard
IfThenElse showing property behind "IF", even when condition is not true
Prerequisites
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [X] I have read the documentation
- [X] Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
core
Version
5.x
Current Behavior
When making a conditional property using the IfThenElse in an allOf and this property is not set (and also doesn;t validate the IF condition), it's still being shown.
In the minimal playground example, the "food" item is behind an if when animal: true - but the item is still shown when no animal is chosen by default
Expected Behavior
A property behind IF should not be shown by default
Steps To Reproduce
Environment
No response
Anything else?
No response
This is not a bug. The condition "required": [ "animal" ] needs to be in the if block if you want it to only be true when animal is not null.
Closing as the solution was provided