Files
marketplaces/src/app/features/content-management/components/static-pages-editor.component.html
sdarbinyan a03260eccf fix(builder): WCAG 2.1 AA accessibility fixes
RC A11Y-01 audit pass, Builder (project-editor) + content-management static
pages editor. Builds on 4ebc15f's composition pass without redoing it.

- Skip link: Builder's /edit and /edit/:section routes render outside the
  storefront app-shell (isAdminRoute() branch has no skip link/landmark, only
  a bare router-outlet, unlike the storefront's app.html) - added a
  "skip to content" link targeting a new #builder-main-content landmark on
  project-editor-page.component, reusing the existing adminShell.skipToContent
  key and global .skip-link style. Nav landmark already had aria-label
  (builder.appName) from the prior pass, verified correct.
- Save bar: added role="status"/aria-live="polite" to the save/publish status
  block and role="status" to the draft-restored notice so save/publish state
  changes and draft recovery are announced to screen readers (previously
  silent DOM updates).
- Media picker (shared, used by both Builder and static-pages editor): upload
  error message had no aria-live wiring - added role="alert".
- HTML editor (marketplace-html-editor): the contenteditable rich-text surface
  had no accessible role/name - added role="textbox", aria-multiline="true",
  aria-label.
- Drag-and-drop keyboard fallback (WCAG 2.1.1): homepage-section's block list
  and footer-section's column list + per-column link list use Angular CDK
  drag-drop (cdkDrag/cdkDropList), which has no built-in keyboard reordering.
  Added move-up/move-down icon buttons (disabled at the first/last boundary),
  matching the existing pattern already used by widgets-section and
  navigation-section.
- Color picker: the swatch <input type="color"> had no accessible name (only
  the paired text input was labelled via app-form-field) - added explicit
  ariaLabel bindings to all 8 color-picker instances in theme-section.
- Languages: the new-locale code input relied on a placeholder ("de") as its
  only accessible name - added ariaLabel + new builder.newLanguageLabel i18n
  key (en/ru/hy).
- Undefined CSS var --color-primary (never defined anywhere, silently used its
  hardcoded hex fallback and never responded to tenant theming - same
  recurring bug class as 4ebc15f) - remapped to the real --primary-color token
  in marketplace-html-editor, homepage-section, and section.shared (7 usages).
- role="alert" added to all 11 validation-error <p class="editor-error">
  occurrences across footer/homepage/languages/navigation/preview/widgets
  sections and the static-pages editor, so field/section validation messages
  are announced.
- scope="col" added to preview-section's change-summary table headers.

Flagged, not fixed (design-system decisions, matching the storefront pass's
precedent):
- Save bar's --warning-color/--error-color/--info-color text fail WCAG AA
  4.5:1 in some themes - same genuine brand semantic colors flagged (not
  fixed) in fb1afb7's storefront pass; needs a deliberate token decision,
  not a Builder-specific issue.
- locale-tabs (app-locale-tabs, shared) has role="tablist"/"tab" and
  aria-selected but no roving-tabindex/arrow-key navigation - matches the
  same partial-tablist pattern already accepted for product-tabs in the
  storefront pass; all tabs remain natively Tab-focusable, so this meets
  4.1.2/2.1.1 without the full ARIA authoring-practice pattern.

Verified: npx tsc --noEmit clean; npm run build green (only the pre-existing
bundle-budget warning, unrelated to this pass).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 09:01:38 +04:00

98 lines
4.7 KiB
HTML

<app-section-card>
@if (fieldError('staticPages'); as msg) {
<p class="editor-error" role="alert">{{ msg }}</p>
}
@if (editingPage(); as page) {
<app-page-editor
[page]="page"
[locales]="locales()"
[defaultLocale]="defaultLocale()"
[hasDuplicateSlug]="hasDuplicateSlug(page)"
[hasDuplicateRoute]="hasDuplicateRoute(page)"
[hasEmptyTitle]="hasEmptyTitle(page)"
[hasInvalidHtml]="hasInvalidHtml(page)"
[hasInvalidSeo]="hasInvalidSeo(page)"
(close)="closeEditor()"
(updatePage)="updatePage(page.id, $event)"
(updateTranslation)="updateTranslation(page.id, $event.locale, $event.field, $event.value)"
(updateSeo)="updateSeo(page.id, $event)"
(updateGallery)="updateGallery(page.id, $event)"
(openMediaPicker)="openMediaPicker(page.id, $event)"
(clearMedia)="clearMedia(page.id, $event)"
(duplicatePage)="duplicatePage(page.id)"
(deletePage)="deletePage(page.id)"
/>
} @else {
<div class="editor-actions">
<h2>{{ 'builder.staticPages' | translate }}</h2>
<app-button variant="primary" (click)="createPage()">{{ 'builder.createPage' | translate }}</app-button>
</div>
<app-content-dashboard [health]="contentHealth()" (createPage)="createPage()" (goToPage)="openEditor($event)" />
<div class="editor-grid three static-pages-toolbar">
<app-form-field [label]="'staticPages.searchPlaceholder' | translate">
<app-input [ngModel]="searchQuery()" (ngModelChange)="updateSearchQuery($event)" [placeholder]="'staticPages.searchPlaceholder' | translate" />
</app-form-field>
<app-form-field [label]="'staticPages.statusLabel' | translate">
<app-select [options]="statusFilterOptions()" [ngModel]="statusFilter()" (ngModelChange)="updateStatusFilter($event)" />
</app-form-field>
<app-form-field [label]="'builder.languagesTab' | translate">
<app-select [options]="localeFilterOptions()" [ngModel]="localeFilter()" (ngModelChange)="updateLocaleFilter($event)" />
</app-form-field>
</div>
@if (pages().length > 0) {
<div class="editor-actions static-pages-bulk-bar">
<label class="toggle-row">
<app-toggle [ngModel]="allVisibleSelected()" (ngModelChange)="toggleSelectAllVisible($event)" [ariaLabel]="'staticPages.selectAll' | translate" />
<span>{{ 'staticPages.selectAll' | translate }}</span>
</label>
@if (selectedCount() > 0) {
<span>{{ selectedCount() }} {{ 'staticPages.selectedCount' | translate }}</span>
<app-button variant="secondary" size="sm" (click)="bulkSetEnabled(true)">{{ 'staticPages.bulkEnable' | translate }}</app-button>
<app-button variant="secondary" size="sm" (click)="bulkSetEnabled(false)">{{ 'staticPages.bulkDisable' | translate }}</app-button>
<app-button variant="secondary" size="sm" (click)="bulkSetStatus('published')">{{ 'staticPages.bulkPublishAction' | translate }}</app-button>
<app-button variant="secondary" size="sm" (click)="bulkSetStatus('draft')">{{ 'staticPages.bulkUnpublish' | translate }}</app-button>
<app-button variant="danger" size="sm" (click)="bulkDelete()">{{ 'staticPages.bulkDelete' | translate }}</app-button>
}
</div>
}
@if (pages().length === 0) {
<app-empty-state [title]="'contentManagement.emptyStateGuideTitle' | translate" [description]="'contentManagement.emptyStateGuideBody' | translate">
<span slot="actions">
<app-button variant="primary" (click)="createPage()">{{ 'builder.createPage' | translate }}</app-button>
</span>
</app-empty-state>
}
<div class="page-card-grid">
@for (page of pages(); track page.id) {
<div class="page-card-grid__item">
<label class="page-card-grid__select">
<app-toggle [ngModel]="isSelected(page.id)" (ngModelChange)="toggleSelect(page.id, $event)" [ariaLabel]="page.id" size="sm" />
</label>
<app-page-card
[page]="page"
[legalLabelKey]="legalLabelKey(page)"
[seoStatus]="seoStatus(page)"
[hasIssue]="hasAnyIssue(page)"
[updatedAtLabel]="updatedAtLabel(page)"
(open)="openEditor(page.id)"
(duplicate)="duplicatePage(page.id)"
(preview)="togglePreview(page.id)"
(remove)="deletePage(page.id)"
/>
@if (previewOpenPageId() === page.id) {
<app-static-page-preview [html]="previewHtml(page)" [title]="previewTitle(page)" />
}
</div>
}
</div>
}
<app-media-picker [open]="mediaPickerOpen" (selected)="onImagePicked($event)" (closed)="mediaPickerOpen = false" />
</app-section-card>