inveniosoftware / inveniosoftware/react-invenio-forms

ArrayField - UX issue in validation error handling when only one Field has a validation error

Open
#285 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2
Forks
37
PR merge metrics
No merged PRs in 30d

Description

I would like to ask what is the reason behind the `hasGroupErrors` method in `ArrayField`:
https://github.com/inveniosoftware/react-invenio-forms/blob/016b12b63b38dc25658c83f539f384519cead4e2/src/lib/forms/ArrayField.js#L27-L35

https://github.com/inveniosoftware/react-invenio-forms/blob/016b12b63b38dc25658c83f539f384519cead4e2/src/lib/forms/ArrayField.js#L88-L92

What I don't understand is why there is an error object `hasError` that gets propagated down to SUI's `Form.Field` component. The UX problem I'm encountering here is if there is only one error in any field of the `ArrayField`, the whole `ArrayField` turns red (since empty `error` object in `hasError` is truthy in SUI's `Form.Field` props), and not just the specific Field with an error I would expect to be highlighted as red/error-y.

![Image](https://github.com/user-attachments/assets/695febf4-6cdc-463f-8a0e-7c26ed262b90)

I would expect this outcome:

![Image](https://github.com/user-attachments/assets/053434a6-0b9a-4163-ba0c-0c476470e04f)

Also, related to this empty `error` object, there's React warning in the console:

![Image](https://github.com/user-attachments/assets/2d0b0445-4df9-498c-b08c-0b735ba2e2ee)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.