fix(edit-content): show validation border on required file/image fields#35254
fix(edit-content): show validation border on required file/image fields#35254
Conversation
|
Claude finished @oidacra's task in 3m 40s —— View job PR Review
To address the Copilot comment first: the validation message IS displayed. Issues1. Inconsistent mechanisms for the same problem Binary field and file field now use two completely different approaches for validation feedback:
2. File field CVA never calls After removing
The fix overcorrects. The original bug was calling 3. Leaky abstraction in // base-control-value-accesor.ts:13
abstract $hasError?: InputSignal<boolean>;This abstract property is optional ( 4.
5. Missing tests for The new tests cover binary field validation only. There are no tests that:
The Minor
Clean
|
There was a problem hiding this comment.
Pull request overview
Updates the edit-content binary/image field styling so required validation failure is visually indicated, aligning the field’s UX with the form’s invalid/touched behavior when saving.
Changes:
- Add invalid-state SCSS selectors to render a red border when the binary field’s host control is invalid and touched/dirty.
Add SCSS rules to show red border on the binary/image field container when the form control is invalid and touched/dirty (e.g., on Save with empty required image field). Closes #33682
- Use PrimeNG CSS variables for consistent border styling across binary, file, and image fields (--p-inputtext-border-color, --p-inputtext-border-radius, --p-inputtext-invalid-border-color) - Fix premature validation in dot-file-field by removing onTouched() call from handleStoreValueChange (was marking control as touched on init) - Add validation border CSS class binding via $hasError() input for file fields - Add validation unit tests for binary field component Closes #33682
2584d23 to
22e5972
Compare
Summary
onTouched()being called during store initializationCloses #33682
Changes
dot-edit-content-binary-field.component.scss--p-inputtext-border-color,--p-inputtext-border-radius,--p-inputtext-invalid-border-color) for border styling; add:host.ng-invalid.ng-touchedrule for error statedot-file-field.component.html[class.border-color-error]binding via$hasError()inputdot-file-field.component.scss.border-color-errorclass using--p-inputtext-invalid-border-colordot-file-field.component.tsonTouched()fromhandleStoreValueChangeto prevent premature touched state on initdot-edit-content-binary-field.component.spec.tsAcceptance Criteria
Test Plan
Visual Changes
This PR fixes: #33682