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-9041) Popover directive HCT contrast #19835

Merged
merged 7 commits into from
Jan 10, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ export interface FeatureTogglesInterface {
*/
a11yPopoverFocus?: boolean;

/**
* Fix popover appearance when a High Contrast Theme is applied.
*/
a11yPopoverHighContrast?: boolean;

/**
* Adds Datepicker and Combobox label and corrects heading order for 'CheckoutScheduleReplenishmentOrderComponent'.
*/
Expand Down Expand Up @@ -984,6 +989,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yPreventHorizontalScroll: false,
a11yReorderDialog: true,
a11yPopoverFocus: true,
a11yPopoverHighContrast: false,
a11yScheduleReplenishment: true,
a11yScrollToTop: true,
a11ySavedCartsZoom: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ if (environment.cpq) {
a11yPreventHorizontalScroll: true,
a11yReorderDialog: true,
a11yPopoverFocus: true,
a11yPopoverHighContrast: true,
a11yScheduleReplenishment: true,
a11yScrollToTop: true,
a11ySavedCartsZoom: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,16 @@ export class PopoverDirective implements OnInit {
this.cxPopoverOptions?.autoPositioning;

if (this.cxPopoverOptions?.appendToBody) {
const body = this.winRef.document.body;
const element = this.featureConfigService?.isEnabled(
'a11yPopoverHighContrast'
)
? // we need to select first child element if exists,
// otherwise HCT theming in popover will not be picked up.
(body.firstElementChild ?? body)
: body;
this.renderer.appendChild(
this.winRef.document.body,
element,
this.popoverContainer.location.nativeElement
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,14 @@
font-size: 1rem;
}
}

@include cx-highContrastTheme {
background-color: var(--cx-color-background);
box-shadow: none;
.popover-body > .cx-close-row {
.close {
color: var(--cx-color-text);
}
}
}
}
Loading