Skip to content

Commit

Permalink
fix: scroll to top visible if consents banner is displayed (#19755)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdrozdsap authored Dec 16, 2024
1 parent 4b1afcf commit db2941f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,12 @@ export interface FeatureTogglesInterface {
*/
showRealTimeStockInPDP?: boolean;

/**
* When enabled, the scroll-to-top button adjusts its position when other UI elements
* (like cookie consent banner) appear at the bottom of the page to prevent overlapping
*/
a11yScrollToTopPositioning?: boolean;

/**
* Creates a section element with applied aria-label in "Review Order" page of the checkout.
* Moves components to be children of this section element.
Expand Down Expand Up @@ -1026,6 +1032,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yHamburgerMenuTrapFocus: false,
useExtendedMediaComponentConfiguration: false,
showRealTimeStockInPDP: false,
a11yScrollToTopPositioning: false,
enableSecurePasswordValidation: false,
enableCarouselCategoryProducts: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ if (environment.cpq) {
a11yHamburgerMenuTrapFocus: true,
useExtendedMediaComponentConfiguration: true,
showRealTimeStockInPDP: false,
a11yScrollToTopPositioning: false,
a11yWrapReviewOrderInSection: true,
enableCarouselCategoryProducts: true,
enableSecurePasswordValidation: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Component, OnDestroy, ViewContainerRef } from '@angular/core';
import { AnonymousConsentsService } from '@spartacus/core';
import { AnonymousConsentsService, useFeatureStyles } from '@spartacus/core';
import { Observable, Subscription } from 'rxjs';
import { tap } from 'rxjs/operators';
import { LAUNCH_CALLER } from '../../../layout/launch-dialog/config/launch-config';
Expand All @@ -25,7 +25,9 @@ export class AnonymousConsentManagementBannerComponent implements OnDestroy {
protected anonymousConsentsService: AnonymousConsentsService,
protected vcr: ViewContainerRef,
protected launchDialogService: LaunchDialogService
) {}
) {
useFeatureStyles('a11yScrollToTopPositioning');
}

viewDetails(): void {
this.hideBanner();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@
background-color: var(--cx-color-background);
}
}

@include forFeature('a11yScrollToTopPositioning') {
&:has(.anonymous-consent-banner) ~ cx-scroll-to-top {
bottom: 180px;
}
}
}

0 comments on commit db2941f

Please sign in to comment.