Skip to content

Commit

Permalink
fix: guessInitialState() state name 'hidden' does not exists
Browse files Browse the repository at this point in the history
Visibility setting 'Hidden' in webform UI is actually named 'invisible' in the code. Previous state
name 'hidden' does not exist.

Example 'Hidden' state YAML:

```
name:
  '#type': textfield
  '#title': Name
  '#required': true
  '#states':
    invisible:
      ':input[name="show_textfield"]':
        unchecked: true
```
  • Loading branch information
hyrsky committed Mar 4, 2020
1 parent 779a19d commit b7aa14b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function checkConditions(element: Element, conditions: State['condition']): bool
* reduce flickering and elements jumping around.
*
* Guesses:
* - If hidden|visible states are present assume they are used to initally hide.
* - If invisible|visible states are present assume they are used to initally hide.
*
* @param states
*/
Expand All @@ -61,7 +61,7 @@ function guessInitialState(states: State[]) {

for (const state of states) {
switch (state.state) {
case 'hidden':
case 'invisible':
initialState[state.state] = true
case 'visible':
default:
Expand Down

0 comments on commit b7aa14b

Please sign in to comment.