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

feat(26339): Improve errors display in RJSF forms and handle focus on hidden widget #646

Merged
merged 18 commits into from
Nov 25, 2024

Conversation

vanch3d
Copy link
Contributor

@vanch3d vanch3d commented Nov 15, 2024

See https://hivemq.kanbanize.com/ctrl_board/57/cards/26339/details/

The PR significantly improves the rendering of the error summary in all the RJSF-based forms. The main problem was error messages mentioning an input field that might be on a grouping tab not currently active or within a "collapsed" item in an array. In such situations, not only would the field with the property not be visible to the users, but its location would not even be mentioned.

Design

  • The warning in the browser for trying to focus on a hidden DOM element has been removed by disabling HTML5 validation that was already creating conflict with the form-based validation
  • The error list has been redesigned to include two elements on each item
    • If an error is in a tab, the name of the tab is displayed before the error message
    • a "link" to the field in question is added after the error message
  • Both items are clickable buttons and will shift the focus to the relevant field
  • If the tab containing the button is not active, it will be activated first before the focus is shifting

Out-of-scope

  • The errors in the form are all itemised, potentially resulting in a very long list. Filtering and grouping could help error management but will be handled in a different ticket

Before

screenshot-localhost_3000-2024_11_21-11_21_30

After

screenshot-localhost_3000-2024_11_21-11_22_18

@vanch3d vanch3d self-assigned this Nov 15, 2024
@cla-bot cla-bot bot added the cla-signed label Nov 15, 2024
@vanch3d vanch3d marked this pull request as draft November 15, 2024 13:27
@vanch3d vanch3d force-pushed the feat/26339/error-focus branch from da63770 to 558a9e4 Compare November 18, 2024 16:23
@vanch3d vanch3d force-pushed the feat/26339/error-focus branch from 558a9e4 to 52d0add Compare November 20, 2024 08:19
@vanch3d vanch3d marked this pull request as ready for review November 21, 2024 10:18
Copy link
Contributor

@oli-hivemq oli-hivemq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing major but I left a few comments

@vanch3d vanch3d merged commit 1586432 into master Nov 25, 2024
9 checks passed
@vanch3d vanch3d deleted the feat/26339/error-focus branch November 25, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants