Skip to content

feat(#1984): style warning-level validation feedback differently from errors#2009

Open
MaryamMehd wants to merge 1 commit into
mainfrom
issue/1984-validation-feedback-severity
Open

feat(#1984): style warning-level validation feedback differently from errors#2009
MaryamMehd wants to merge 1 commit into
mainfrom
issue/1984-validation-feedback-severity

Conversation

@MaryamMehd

@MaryamMehd MaryamMehd commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #1984

  • Adds a new useValidationFeedbackSeverity hook that returns both the feedback message and its severity ('error' | 'warning'), sourced from targetConstraint.severityCode and OperationOutcome.issue.severity.
  • Refactors the existing useValidationFeedback hook into a deprecated wrapper around the new hook (backwards-compatible).
  • Updates all *Item.tsx components (~25 files) to consume the new hook and pass feedbackSeverity down to their field components.
  • Updates all *Field.tsx components (~20 files) to accept feedbackSeverity and apply appropriate styling:
    • Error → red border + red helper text (existing behaviour, unchanged).
    • Warning → no red border + amber helper text (new behaviour).
  • Adds unit tests for useValidationFeedbackSeverity covering error, warning, and parent-feedback scenarios.

Test plan

  • Load a questionnaire with a targetConstraint extension using severityCode = 'warning' — helper text should appear in amber with no red border on the field.
  • Load a questionnaire with a targetConstraint extension using severityCode = 'error' — behaviour is unchanged (red border + red helper text).
  • Run unit tests: npm run test in packages/smart-forms-renderer.

Made with Cursor

Add useValidationFeedbackSeverity hook returning { feedback, feedbackSeverity }.
Warning-level targetConstraint violations and OperationOutcome issues now render
with amber helper text and no red border, while error-level feedback continues
to use the existing red styling. useValidationFeedback is kept as a deprecated
thin wrapper for backward compatibility.

Co-authored-by: Cursor <cursoragent@cursor.com>
@MaryamMehd
MaryamMehd requested a review from clinnygee July 20, 2026 04:02
@MaryamMehd
MaryamMehd marked this pull request as ready for review July 20, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style warning-level validation feedback differently from errors

2 participants