Skip to content

fix(edit-content): category field button styles, clear-all & chip alignment - #36438

Merged
adrianjm-dotCMS merged 3 commits into
mainfrom
issue-36379-category-field-improvements
Jul 6, 2026
Merged

fix(edit-content): category field button styles, clear-all & chip alignment#36438
adrianjm-dotCMS merged 3 commits into
mainfrom
issue-36379-category-field-improvements

Conversation

@adrianjm-dotCMS

@adrianjm-dotCMS adrianjm-dotCMS commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Closes #36379

  • Selector dialog: Apply is now primary (default), Cancel is tertiary ([text]="true" severity="secondary"), matching the convention used in other recent dialogs (e.g. image-editor-footer, ai-content-dialog). The dialog's existing "Clear all" is untouched.
  • Category field component: Select button is now primary. Added a new field-level "Clear all" button (data-testId="clear-all-btn") so users can clear all selected categories without opening the dialog — the field value auto-empties via the existing store.selected() effect, no extra wiring needed.
  • Chip layout: fixed centered rows on wrap (justify-centerjustify-start).
  • Chip X position: investigated moving the remove icon to the left of the label. PrimeNG's Chip template has no input to reorder it, so it's applied as a flexbox order: -1 rule on .p-chip-remove-icon at the theme level (theme.config.ts), app-wide. DOM/tab order is unaffected, only the visual order changes.
  • Tags field propagation: per the issue comment, checked whether the X-to-left change needs to propagate to Tags. PrimeNG's p-autoComplete multi-value tokens render as real p-chip instances internally, so the theme-level fix already applies there with no extra code.
  • Bonus: while comparing both chip implementations, noticed the Tags field's remove icon wasn't vertically centered (missing the flex wrapper that Category's chip template has) — fixed for visual consistency.
  • Unrelated one-line cleanup: removed a duplicated FEATURE_FLAG_LOCALE_SELECTOR_V2 line in dotmarketing-config.properties.

Images

Screenshot 2026-07-06 at 2 06 33 PM Screenshot 2026-07-06 at 2 06 43 PM Screenshot 2026-07-06 at 2 06 59 PM Screenshot 2026-07-06 at 2 44 55 PM

Unit tests added

  • dot-category-field.component.spec.ts: Clear all button renders only with selections, invokes clearAllSelected() on click, clears the store and emits an empty value via the CVA onChange callback, Select button no longer carries secondary/text classes.
  • dot-category-field-dialog.component.spec.ts: Cancel/Apply render as tertiary (text + secondary) / primary respectively (asserted on the Button component instance, not CSS strings).
  • dot-category-field-chips.component.spec.ts: chip container uses justify-start instead of justify-center.
  • Not unit-tested: the chip remove-icon order: -1 rule — it's a global theme.config.ts CSS rule that jsdom doesn't apply, so a unit test would be a false positive. Verify visually.

Test plan

  • Add unit test coverage for the new "Clear all" button and severities
  • Open a content with a Category field, select several categories so chips wrap to 2+ rows → confirm left alignment on every row
  • Confirm the chip "X" renders to the left of the label on both Category and Tags fields
  • Confirm Tags field "X" is vertically centered
  • Open the category selector dialog → Apply renders primary, Cancel renders tertiary (text/secondary)
  • On the field (dialog closed), click "Clear all" → all chips disappear and the field value is empty
  • Existing dialog "Clear all" still works as before

This PR fixes: #36379

…nment & X position (#36379)

- Apply is primary / Cancel is tertiary (text + secondary) in the
  "Select categories" dialog, matching the convention used in other
  recent dialogs.
- Select button on the category field is now primary.
- Added a field-level "Clear all" so users can remove every selected
  category without opening the dialog; the field value auto-empties
  via the existing selected-categories effect.
- Fixed chips centering on wrap (justify-center -> justify-start).
- Moved the chip remove ("X") icon to the left of the label app-wide
  via a theme-level flexbox order rule, since PrimeNG's Chip template
  has no input to reorder it. This also propagates to the Tags field,
  whose multi-value tokens render as p-chip internally.
- Vertically centered the Tags field remove icon to match Category's
  chip markup (unrelated visual inconsistency spotted while comparing
  both chip implementations).

Also removes a duplicated FEATURE_FLAG_LOCALE_SELECTOR_V2 line in
dotmarketing-config.properties (unrelated one-line cleanup).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @adrianjm-dotCMS's task in 3m 39s —— View job


Rollback-Safety Analysis

  • Read docs/core/ROLLBACK_UNSAFE_CATEGORIES.md
  • Get full PR diff (5efb47a..888a116 — the 3 commits on this branch)
  • Analyze diff against every unsafe category
  • Post verdict / apply label

Files changed (11): all in core-web/ (Angular) plus two backend property/resource files — no Java logic, no SQL, no runonce tasks, no ES mapping code.

File Change Category check
dot-category-field-chips.component.html justify-centerjustify-start on chip container Pure CSS — no match
dot-category-field-dialog.component.html Cancel button: p-button-outlined[text]="true" severity="secondary" Pure UI styling — no match
dot-category-field.component.html New "Clear all" button + Select button class change Pure UI — no match
dot-category-field.component.ts New clearAllSelected() method calling existing store.removeRootSelected() Client-side NgRx-style store call, not a REST/GraphQL endpoint — doesn't trigger M-3
tag-field.component.html Wrapped remove icon in a <span> for centering Pure UI — no match
theme.config.ts Added .p-chip .p-chip-remove-icon { order: -1; } Pure CSS, app-wide but purely visual, no DOM/contract change — no match
dotmarketing-config.properties Removed a duplicated FEATURE_FLAG_LOCALE_SELECTOR_V2=true line Duplicate cleanup only — flag key/value unchanged, no match
Language.properties Added new key edit.content.category-field.clear-all=Clear all Additive i18n key — no match
*.spec.ts files Test-only Out of scope per instructions

No runonce DB migration, no ES mapping/ESMappingAPIImpl/ESMappingConstants change, no contentlet_as_json model version change, no DROP/RENAME/PK change, no new ContentType field type, no storage provider change, no REST/GraphQL contract change, no OSGi interface change, no VTL viewtool contract change. This PR is Angular component/theme changes plus a duplicate-line cleanup and a new translation key — nothing that N-1 would read, write, or serve differently after rollback.

Verdict: ✅ Safe to roll back. Label AI: Safe To Rollback applied.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🤖 dotBot Review (Bedrock)

Reviewed 11 file(s); 7 candidate(s) → 3 confirmed, 0 uncertain (unverified, kept for review).

Confirmed findings

  • 🟡 Medium core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field/dot-category-field.component.html:15 — Select button missing primary style class
    The 'Select' button in dot-category-field.component.html line 15 shows removal of secondary classes but lacks p-button-primary addition. PR description explicitly states 'Select button is now primary' as part of Category field improvements: button styles, clear-all, chip X position, multi-row alignment (Edit Contentlet) #36379 requirements, and the current implementation only shows m-1 class without primary styling.
  • 🟡 Medium core-web/libs/edit-content/src/lib/fields/dot-edit-content-category-field/components/dot-category-field/dot-category-field.component.spec.ts:70 — Test directly accesses store internal state via store.selected().length
    The test checks store.selected().length directly, coupling it to implementation details. Tests should verify component output (CVA onChange emission) rather than internal store state. While the onChange check exists, the store access creates brittle tests that may break if store implementation changes.
  • 🟡 Medium core-web/libs/ui/src/lib/theme/theme.config.ts:101 — Accessibility mismatch in chip remove button order
    Using order: -1 on .p-chip-remove-icon changes visual layout but leaves DOM/tab order unchanged. This creates a disconnect between visual presentation (X before label) and keyboard navigation sequence (label focused first then X), violating WCAG 2.1 Success Criterion 1.3.2 (Meaningful Sequence) and 2.4.3 (Focus Order). Confirmed via PrimeNG chip template inspection showing default DOM order is label followed by remove button.

us.deepseek.r1-v1:0 · Run: #28814552873 · tokens: in: 77671 · out: 15187 · total: 92858 · calls: 27 · est. ~$0.187

… & chip alignment

Adds unit coverage for the behavior added in the previous commit:
- Field-level "Clear all" button renders only with selections, clears
  the store and emits an empty value, invokes clearAllSelected() on click.
- Select button no longer carries secondary/text classes (primary).
- Dialog's Cancel/Apply render as tertiary (text+secondary) / primary
  respectively, asserted via the Button component instance rather than
  CSS class strings.
- Chips container uses justify-start instead of justify-center.

Skips unit-testing the chip remove-icon `order: -1` CSS rule itself,
since it's a global theme.config.ts rule jsdom doesn't apply — not
meaningfully testable without a visual/e2e check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nent

Rearranges the class order in the category field chips component's HTML to improve alignment. The `justify-start` class is now positioned after `flex-wrap` for better readability and consistency with other components. This change enhances the layout without altering functionality.
@adrianjm-dotCMS
adrianjm-dotCMS marked this pull request as ready for review July 6, 2026 18:45
@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@adrianjm-dotCMS
adrianjm-dotCMS added this pull request to the merge queue Jul 6, 2026
Merged via the queue into main with commit 8fbb0d8 Jul 6, 2026
73 checks passed
@adrianjm-dotCMS
adrianjm-dotCMS deleted the issue-36379-category-field-improvements branch July 6, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Category field improvements: button styles, clear-all, chip X position, multi-row alignment (Edit Contentlet)

2 participants