Repository navigation
fix(forms): don't mark an emptied required field while typing - #946
Merged
Merged
Conversation
A literal text field is validated on every keystroke, so that an ill-typed value is marked as it is typed. A required field that was filled in and then emptied failed that check too and turned red at once, while one never filled in is only marked when the form is submitted. This showed in inline thread forms and on the publish page alike. The required check is now left to submitting: when the input is empty (the only error then possible, as the other validators don't run on an empty input), the error from the keystroke check is dropped and the field is not marked. Ill-typed values are still marked while typing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
🎉 This PR is included in version 5.23.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
A literal text field (single-line or text area) is validated on every keystroke, so that an ill-typed value is marked as it is typed (since 2026-09-30). A required field that was filled in and then emptied failed that check as well and got the red border at once. A required field never filled in is only marked when the form is submitted. This happened in inline thread forms (#943) and on the publish page alike.
What changes
In
LiteralTextfieldItem's keystroke check, an empty input no longer marks the field. Its only possible error is the missing value, since the other validators don't run on an empty input, so that error is dropped. It then neither marks the field nor turns up if the field is rendered again before submitting. The required check happens on Publish or Preview, as for a field never filled in. Ill-typed values (datatype, pattern, SPARQL) are still marked while typing.Other field types aren't affected: only literal text fields toggle their highlighting while typing.
Testing
Three new tests in
LiteralDatatypeValidationTest:All three fail without the change. The other literal-field tests and
ThreadNodePanelTestpass.In the browser, on
/publishand in an inline thread form: type into the required text area, then empty it. The border stays grey. Preview then marks it red with "'statement text' is required."🤖 Generated with Claude Code