Give ids to array and object fields #1102
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change:
<fieldset>
tag in the default array field template and object field template<fieldset>
in the form.Reasons for making this change
This way, we are more consistent with the idSchema, so that every id mentioned in the idSchema actually has a corresponding element rendered in the DOM. This allows us to create anchor links that go to specific elements, even if they are not
<input>
or<select>
elements.For example, on the "Arrays" example in the playground, here is the idSchema:
However, there are no elements with ids equal to "root", "root_fixedItemsList", etc. This change fixes that.
This change was especially motivated by looking into #86 -- sometimes you may have a validation error that refers to an array element (such as minimum items not being reached). If there is no corresponding DOM ID corresponding to the idSchema value for that element, then we cannot create anchor links that go to the specific element with the error.
Checklist
npm run cs-format
on my branch to conform my code to prettier coding style