decaporg / decaporg/decap-cms

Vaildation error is not shown on collapsed objects

Open
#5,630 5 comments 0 reactions 0 assignees View on GitHub
area: extensions/widgets pinned type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
If a field inside a collapsed object fires a validation error, the entry will not be saved. This is the correct behavior, but the problem is, that there is no indication of where the error occurs.

**To Reproduce**
Steps to reproduce the behavior. For example:
1. Create an object field and add `collapsed: true`
2. Add a required sub-field
3. Leave the sub-field empty and try to save the entry.
4. See a general error notification at the top and observe that there is no notification on the collapsed object

**Expected behavior**
If a field is collapsed and it includes objects with validation errors, it should also be treated as a field with an error. It should get a red border and an explanation text in red color.

**Screenshots**
Collapsed - there is no indication that a required filed is empty in services object
![Screenshot 2021-07-19 at 11 12 35](https://user-images.githubusercontent.com/42938138/126135838-762af98a-3ae2-447a-a010-a798054f61a7.png)

Uncollapsed
![Screenshot 2021-07-19 at 11 12 46](https://user-images.githubusercontent.com/42938138/126135827-83b3ca4f-ffc1-4d82-b87b-ca42423d3d54.png)

**Applicable Versions:**
- Netlify CMS version: 2.10.147
- Git provider: GitHub
- OS: MacOS 11.4 (20F71)
- Browser version: Brave 1.26

**CMS configuration**
Example configuration for a collapsed object with a required string field. This happens on any global configuration I believe.

```yml
{name: services, widget: object, collapsed: true, summary: fields: [
{name: title, widget: string}
]}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.