Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: (CXSPA-9055) - Region associated headers #19883

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<ng-container *ngIf="accountSummary$ | async as accountSummary">
<div>
<div role="region" aria-labelledby="regionTitle">
<!-- HEADER -->
<div class="cx-account-summary-document-header">
<h2>
<h2 id="regionTitle">
{{ 'orgAccountSummary.document.header' | cxTranslate }}
</h2>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
[viewTitle]="i18nRoot + '.title' | cxTranslate: { item: item$ | async }"
class="card"
role="tabpanel"
[attr.aria-labelledby]="i18nRoot + '_title'"
>
<div class="header">
<div class="title-bar">
<div class="title">
<h3>
{{ i18nRoot + '.title' | cxTranslate: { item: item$ | async } }}
<span
*cxFeature="'a11yRegionAssociatedHeaders'"
id="{{ i18nRoot + '_title' }}"
>
{{ i18nRoot + '.title' | cxTranslate: { item: item$ | async } }}
</span>
<ng-container *cxFeature="'!a11yRegionAssociatedHeaders'">
{{ i18nRoot + '.title' | cxTranslate: { item: item$ | async } }}
</ng-container>
<button
*ngIf="showHint"
[cxPopover]="detailHint"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { GlobalMessageService, I18nTestingModule } from '@spartacus/core';
import { PopoverModule, SplitViewService } from '@spartacus/storefront';
import { IconTestingModule } from 'projects/storefrontlib/cms-components/misc/icon/testing/icon-testing.module';
import { ViewComponent } from 'projects/storefrontlib/shared/components/split-view/view/view.component';
import { MockFeatureDirective } from 'projects/storefrontlib/shared/test/mock-feature-directive';
import { of } from 'rxjs';
import { ItemService } from '../item.service';
import { MessageTestingModule } from '../message/message.testing.module';
Expand Down Expand Up @@ -39,7 +40,7 @@ describe('CardComponent', () => {
MessageTestingModule,
PopoverModule,
],
declarations: [CardComponent, ViewComponent],
declarations: [CardComponent, ViewComponent, MockFeatureDirective],
providers: [
{
provide: ItemService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { I18nModule, UrlModule } from '@spartacus/core';
import { IconModule, SplitViewModule } from '@spartacus/storefront';
import { FeaturesConfigModule, I18nModule, UrlModule } from '@spartacus/core';
import {
IconModule,
PopoverModule,
SplitViewModule,
} from '@spartacus/storefront';
import { MessageModule } from '../message/message.module';
import { CardComponent } from './card.component';
import { PopoverModule } from '@spartacus/storefront';
/**
* Provides a reusable card UI component for the organization split views.
*
Expand All @@ -28,6 +31,7 @@ import { PopoverModule } from '@spartacus/storefront';
UrlModule,
MessageModule,
PopoverModule,
FeaturesConfigModule,
],
declarations: [CardComponent],
exports: [CardComponent],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
<cx-split-view [hideMode]="false">
<ng-container *ngIf="structure$ | async as structure">
<cx-view class="list" *ngIf="listData$ | async as data">
<cx-view
class="list"
*ngIf="listData$ | async as data"
role="region"
[attr.aria-labelledby]="viewType + '_title'"
>
<div class="header">
<div aria-live="polite" class="title">
<!-- TODO: (CXSPA-6624) - Remove feature flag next major release -->
<h2 *cxFeature="'a11yOrganizationListHeadingOrder'">
{{
viewType + '.header' | cxTranslate: { count: getListCount(data) }
}}
<span
*cxFeature="'a11yRegionAssociatedHeaders'"
id="{{ viewType + '_title' }}"
>
{{
viewType + '.header'
| cxTranslate: { count: getListCount(data) }
}}
</span>
<ng-container *cxFeature="'!a11yRegionAssociatedHeaders'">
{{
viewType + '.header'
| cxTranslate: { count: getListCount(data) }
}}
</ng-container>
<button
[cxPopover]="listHint"
[cxPopoverOptions]="{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,12 @@ export interface FeatureTogglesInterface {
*/
a11yHamburgerMenuTrapFocus?: boolean;

/**
* Associates content regions with their headers improving readout while navigating between sections.
* Affects: CardComponent, AccountSummaryDocumentComponent, ListComponent
*/
a11yRegionAssociatedHeaders?: boolean;

/**
* When enabled, allows to provide extended formats and media queries for <picture> element if used in MediaComponent.
*
Expand Down Expand Up @@ -1113,6 +1119,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yHideConsentButtonWhenBannerVisible: false,
a11yRepeatingButtonsUniqueLabels: false,
a11yHighContrastBorders: false,
a11yRegionAssociatedHeaders: false,
occCartNameAndDescriptionInHttpRequestBody: false,
cmsBottomHeaderSlotUsingFlexStyles: false,
useSiteThemeService: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ if (environment.cpq) {
a11yHideConsentButtonWhenBannerVisible: true,
a11yRepeatingButtonsUniqueLabels: true,
a11yHighContrastBorders: true,
a11yRegionAssociatedHeaders: true,
cmsBottomHeaderSlotUsingFlexStyles: true,
useSiteThemeService: true,
enableConsecutiveCharactersPasswordRequirement: true,
Expand Down
Loading