fix(edit-content): style comment Send/Clear buttons and add empty-message validation - #36464
Conversation
…sage validation Send is now a primary button and Clear a tertiary (text) button, both always enabled. Submitting an empty or whitespace-only comment now blocks the request and shows a red border plus "A message is required." message below the textarea, which clears once the user types or clicks Clear. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Claude finished @jcastro-dotcms's task in 3m 34s —— View job Code ReviewReviewed the full diff (source + tests + language props) against
New IssuesNo issues found. The changes are well-scoped and the logic holds up:
Minor notes (non-blocking)
The concern @nicobytes raised about the Approving in spirit — nothing blocking merge. |
|
The Option A — use the this.commentControl.setErrors({ required: true });<dot-field-validation-message
[field]="form.get('comment')"
[message]="'edit.content.sidebar.activities.required' | dm" />In Caveat: Option B — extend the shared component to accept a per-key message override for built-in validators (a My preference is Option A here: it gets the same field-specific copy through an API the component already offers, without adding an error key that overlaps with |
…ge override Replaces the custom commentRequired error key with Angular's standard required, avoiding a semantic duplicate. Adds a requiredErrorMessage input to the shared dot-field-validation-message component (mirroring the existing patternErrorMessage) so a field can override just the required-error copy without affecting other validators on the same control. Addresses review feedback: #36464 (comment) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Good catch, thanks @nicobytes. Went with Option B (extend the shared component) rather than Option A as originally described — the literal snippet in Option A binds Implemented in
All 45 tests across the two specs pass. Let me know if you'd rather see this scoped differently. 🤖 Generated with Claude Code |
…p textarea shift activities-footer is `sticky bottom-0`, so when dot-field-validation-message conditionally mounted/unmounted its <small> element, the footer's height changed and, being bottom-anchored, pushed the comment textarea upward. Wraps the validation message in an always-present, fixed-height slot so the footer's height stays constant whether or not the error is showing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…f github.com:dotCMS/core into issue-36372-comment-section-button-styles-validation
|
Fixed the textarea shift (commit `c091148`). Root cause: `activities-footer` is `sticky bottom-0`. `dot-field-validation-message` conditionally mounts/unmounts its `` internally (`@if`), so the row's height changed whenever the error appeared or cleared — and because the footer is bottom-anchored, that height change pushed the textarea upward instead of just growing/shrinking downward. Rather than changing the shared component's internal `@if` to always render (which would add persistent reserved space to all ~25 other usages of `dot-field-validation-message` across the app — login, content types, personas, push-publish, etc. — none of which asked for that), I scoped the fix to this component: wrapped the validation message in a Added a regression test asserting the slot exists and keeps its height class through the no-error → error → cleared cycle. 🤖 Generated with Claude Code |
|
Tick the box to add this pull request to the merge queue (same as
|
Summary
Closes #36372.
Updates the Comments section of the new Edit Contentlet sidebar to match the requested button styling and adds client-side validation for empty comments.
commentRequiredvalidation error key (instead of reusing Angular's built-inrequired) so this field shows our specific copy instead of the shared, generic "This field is required" string used elsewhere in the app.onSubmit():markAsDirty()/markAsTouched()must run beforesetErrors(), since the shareddot-field-validation-messagecomponent recomputes its visibility synchronously off thesetErrors()emission. With the old order, the message could silently never render even though the field's error state was otherwise correct — this applied to the originalrequirederror too, it just wasn't previously covered by any test that checked the rendered text.dot-field-validation-messageout of absolute positioning into normal document flow so it no longer visually overlaps the character counter above it.Test plan
dot-edit-content-sidebar-activities.component.spec.ts(38/38 passing): button enabled/disabled states, required-error message content, error clearing on input/Clear.nx serve dotcms-ui): button styling, empty-submit validation, error-clears-on-type, Clear dismisses the error, valid comment submits successfully.eslintclean on all touched files.🤖 Generated with Claude Code
This PR fixes: #36372