Skip to content

fix(forms): don't mark an emptied required field while typing - #946

Merged
tkuhn merged 1 commit into
masterfrom
fix/inline-required-highlight
Nov 23, 2026
Merged

tkuhn merged 1 commit into
masterfrom
fix/inline-required-highlight

Conversation

@tkuhn

@tkuhn tkuhn commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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:

    • an emptied required field isn't marked and carries no error;
    • emptying an ill-typed required field removes its mark;
    • whitespace-only counts as empty.

    All three fail without the change. The other literal-field tests and ThreadNodePanelTest pass.

  • In the browser, on /publish and 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

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]>
@tkuhn
tkuhn merged commit d52a37e into master Nov 23, 2026
11 of 20 checks passed
@tkuhn
tkuhn deleted the fix/inline-required-highlight branch November 23, 2026 15:28
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.23.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant