Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/CXSPA-9072
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrozdsap authored Jan 30, 2025
2 parents c5ee15c + b3a63b1 commit 7962d98
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions projects/assets/src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"loaded": "Loaded",
"results": "Results",
"of": "of",
"ngSelectDropdownOptionsList": "Options",
"required": "required",
"zoomIn": "Zoom in",
"zoomOut": "Zoom out",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,12 @@ export interface FeatureTogglesInterface {
*/
a11yNgSelectCloseDropdownOnEscape?: boolean;

/**
* 'NgSelectA11yDirective' will customize a ng-select dropdowns by setting custom
* ariaLabelDropdown ng-select attribute value to provided common.ngSelectDropdownOptionsList translation
*/
a11yNgSelectAriaLabelDropdownCustomized?: boolean;

/**
* Removes duplicated error message from 'CancelOrderComponent'.
*/
Expand Down Expand Up @@ -1084,6 +1090,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yDeliveryModeRadiogroup: false,
a11yNgSelectOptionsCount: false,
a11yNgSelectCloseDropdownOnEscape: false,
a11yNgSelectAriaLabelDropdownCustomized: false,
a11yRepeatedCancelOrderError: false,
a11yAddedToCartActiveDialog: false,
a11yNgSelectMobileReadout: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ if (environment.cpq) {
*/
a11yNgSelectOptionsCount: false,
a11yNgSelectCloseDropdownOnEscape: true,
a11yNgSelectAriaLabelDropdownCustomized: true,
a11yRepeatedCancelOrderError: true,
a11yAddedToCartActiveDialog: true,
a11yNgSelectMobileReadout: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export class NgSelectA11yDirective implements AfterViewInit {
*/
@Input() cxNgSelectA11y: { ariaLabel?: string; ariaControls?: string };

//TODO: CXSPA-9005: Remove this property in next major release
/**
* @deprecated since 2211.33
*/
protected translationService = inject(TranslationService);
protected domSanitizer = inject(DomSanitizer);
protected selectComponent = inject(NgSelectComponent);
Expand Down Expand Up @@ -105,6 +101,13 @@ export class NgSelectA11yDirective implements AfterViewInit {

this.renderer.setAttribute(inputCombobox, 'role', 'combobox');
this.renderer.setAttribute(inputCombobox, 'aria-expanded', 'false');
if (
this.featureConfigService?.isEnabled(
'a11yNgSelectAriaLabelDropdownCustomized'
)
) {
this.customizeNgSelectAriaLabelDropdown();
}

const isOpened$ = this.selectComponent.openEvent.pipe(map(() => 'true'));
const isClosed$ = this.selectComponent.closeEvent.pipe(map(() => 'false'));
Expand Down Expand Up @@ -202,4 +205,13 @@ export class NgSelectA11yDirective implements AfterViewInit {
}
observer.disconnect();
}

customizeNgSelectAriaLabelDropdown() {
this.translationService
.translate('common.ngSelectDropdownOptionsList')
.pipe(take(1))
.subscribe((translation) => {
this.selectComponent.ariaLabelDropdown = translation;
});
}
}

0 comments on commit 7962d98

Please sign in to comment.