diff --git a/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.component.html b/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.component.html index 55c3b9b2f33..a4e1b7144e8 100644 --- a/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.component.html +++ b/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.component.html @@ -122,6 +122,7 @@ [routerLink]="{ cxRoute: 'cart' } | cxUrl" (click)="dismissModal('View Cart click')" class="btn btn-primary" + cxBtnLikeLink autofocus >{{ 'addToCart.viewCart' | cxTranslate }} @@ -130,6 +131,7 @@ [routerLink]="{ cxRoute: 'checkout' } | cxUrl" (click)="dismissModal('Proceed To Checkout click')" class="btn btn-secondary" + cxBtnLikeLink >{{ 'addToCart.proceedToCheckout' | cxTranslate }} @@ -273,6 +275,7 @@ [routerLink]="{ cxRoute: 'cart' } | cxUrl" (click)="dismissModal('View Cart click')" class="btn btn-primary" + cxBtnLikeLink autofocus >{{ 'addToCart.viewCart' | cxTranslate }} @@ -281,6 +284,7 @@ [routerLink]="{ cxRoute: 'checkout' } | cxUrl" (click)="dismissModal('Proceed To Checkout click')" class="btn btn-secondary" + cxBtnLikeLink >{{ 'addToCart.proceedToCheckout' | cxTranslate }} diff --git a/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.module.ts b/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.module.ts index 96e89b13697..d22451a138c 100644 --- a/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.module.ts +++ b/feature-libs/cart/base/components/added-to-cart-dialog/added-to-cart-dialog.module.ts @@ -15,6 +15,7 @@ import { UrlModule, } from '@spartacus/core'; import { + BtnLikeLinkModule, IconModule, ItemCounterModule, KeyboardFocusModule, @@ -40,6 +41,7 @@ import { defaultAddedToCartLayoutConfig } from './default-added-to-cart-layout.c ItemCounterModule, KeyboardFocusModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [provideDefaultConfig(defaultAddedToCartLayoutConfig)], declarations: [AddedToCartDialogComponent], diff --git a/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.component.html b/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.component.html index e8398b13a09..7f35b4a31a0 100644 --- a/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.component.html +++ b/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.component.html @@ -87,6 +87,7 @@ {{ diff --git a/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.module.ts b/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.module.ts index 98757588831..f6cae620c49 100644 --- a/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.module.ts +++ b/feature-libs/cart/wish-list/components/add-to-wishlist/add-to-wish-list.module.ts @@ -14,7 +14,11 @@ import { provideDefaultConfig, UrlModule, } from '@spartacus/core'; -import { AtMessageModule, IconModule } from '@spartacus/storefront'; +import { + AtMessageModule, + BtnLikeLinkModule, + IconModule, +} from '@spartacus/storefront'; import { AddToWishListComponent } from './add-to-wish-list.component'; @NgModule({ @@ -26,6 +30,7 @@ import { AddToWishListComponent } from './add-to-wish-list.component'; UrlModule, AtMessageModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.component.html b/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.component.html index 203a3e58fbb..164c236f780 100644 --- a/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.component.html +++ b/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.component.html @@ -1,12 +1,12 @@
{{ 'common.back' | cxTranslate }} diff --git a/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.module.ts b/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.module.ts index a1e79cc5a67..51f1ee7827e 100644 --- a/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.module.ts +++ b/feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.module.ts @@ -9,9 +9,16 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { I18nModule, UrlModule } from '@spartacus/core'; import { AmendOrderActionsComponent } from './amend-order-actions.component'; +import { BtnLikeLinkModule } from '@spartacus/storefront'; @NgModule({ - imports: [CommonModule, RouterModule, UrlModule, I18nModule], + imports: [ + CommonModule, + RouterModule, + UrlModule, + I18nModule, + BtnLikeLinkModule, + ], declarations: [AmendOrderActionsComponent], exports: [AmendOrderActionsComponent], }) diff --git a/feature-libs/order/components/order-details/order-detail-actions/order-detail-actions.component.html b/feature-libs/order/components/order-details/order-detail-actions/order-detail-actions.component.html index fbe98d5694f..0aa7185c009 100644 --- a/feature-libs/order/components/order-details/order-detail-actions/order-detail-actions.component.html +++ b/feature-libs/order/components/order-details/order-detail-actions/order-detail-actions.component.html @@ -11,7 +11,6 @@
{{ 'orderDetails.cancellationAndReturn.cancelAction' | cxTranslate }} {{ 'orderDetails.cancellationAndReturn.returnAction' | cxTranslate }} diff --git a/feature-libs/order/components/order-details/order-details.module.ts b/feature-libs/order/components/order-details/order-details.module.ts index ddbe9c4600e..98ceaef9394 100644 --- a/feature-libs/order/components/order-details/order-details.module.ts +++ b/feature-libs/order/components/order-details/order-details.module.ts @@ -31,6 +31,7 @@ import { PromotionsModule, ProvideOutletOptions, SpinnerModule, + BtnLikeLinkModule, } from '@spartacus/storefront'; import { MyAccountV2ConsignmentTrackingComponent, @@ -110,6 +111,7 @@ const moduleComponents = [ IconModule, MyAccountV2DownloadInvoicesModule, AbstractOrderContextModule, + BtnLikeLinkModule, ], providers: [ OrderOverviewComponentService, diff --git a/feature-libs/order/components/order-history/order-history.component.html b/feature-libs/order/components/order-history/order-history.component.html index 899f3d31fca..4a782f87cbe 100644 --- a/feature-libs/order/components/order-history/order-history.component.html +++ b/feature-libs/order/components/order-history/order-history.component.html @@ -243,6 +243,7 @@

[routerLink]="{ cxRoute: 'home' } | cxUrl" routerLinkActive="active" class="btn btn-primary btn-block" + cxBtnLikeLink >{{ 'orderHistory.startShopping' | cxTranslate }} diff --git a/feature-libs/order/components/order-history/order-history.module.ts b/feature-libs/order/components/order-history/order-history.module.ts index 4c1c37e87bb..a87521d904c 100644 --- a/feature-libs/order/components/order-history/order-history.module.ts +++ b/feature-libs/order/components/order-history/order-history.module.ts @@ -18,6 +18,7 @@ import { UrlModule, } from '@spartacus/core'; import { + BtnLikeLinkModule, ListNavigationModule, MediaModule, SpinnerModule, @@ -56,6 +57,7 @@ const moduleComponents = [ I18nModule, SpinnerModule, MediaModule, + BtnLikeLinkModule, ], declarations: [OrderHistoryComponent, ...moduleComponents], exports: [OrderHistoryComponent, ...moduleComponents], diff --git a/feature-libs/order/components/replenishment-order-details/replenishment-order-cancellation/replenishment-order-cancellation.component.html b/feature-libs/order/components/replenishment-order-details/replenishment-order-cancellation/replenishment-order-cancellation.component.html index ccdad0926f2..41523888088 100644 --- a/feature-libs/order/components/replenishment-order-details/replenishment-order-cancellation/replenishment-order-cancellation.component.html +++ b/feature-libs/order/components/replenishment-order-details/replenishment-order-cancellation/replenishment-order-cancellation.component.html @@ -1,13 +1,13 @@
{{ 'common.back' | cxTranslate }} diff --git a/feature-libs/order/components/replenishment-order-details/replenishment-order-details.module.ts b/feature-libs/order/components/replenishment-order-details/replenishment-order-details.module.ts index f73f9fbd3f3..bc5b827f2e8 100644 --- a/feature-libs/order/components/replenishment-order-details/replenishment-order-details.module.ts +++ b/feature-libs/order/components/replenishment-order-details/replenishment-order-details.module.ts @@ -14,6 +14,7 @@ import { UrlModule, } from '@spartacus/core'; import { + BtnLikeLinkModule, CardModule, ListNavigationModule, PromotionsModule, @@ -42,6 +43,7 @@ const moduleComponents = [ReplenishmentOrderCancellationComponent]; SpinnerModule, ListNavigationModule, RouterModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig(defaultReplenishmentOrderCancellationLayoutConfig), diff --git a/feature-libs/order/components/replenishment-order-history/replenishment-order-history.component.html b/feature-libs/order/components/replenishment-order-history/replenishment-order-history.component.html index 3e49a306773..bf00d5b75b9 100644 --- a/feature-libs/order/components/replenishment-order-history/replenishment-order-history.component.html +++ b/feature-libs/order/components/replenishment-order-history/replenishment-order-history.component.html @@ -282,6 +282,7 @@

[routerLink]="{ cxRoute: 'home' } | cxUrl" routerLinkActive="active" class="btn btn-primary btn-block" + cxBtnLikeLink >{{ 'orderHistory.startShopping' | cxTranslate }}

diff --git a/feature-libs/order/components/replenishment-order-history/replenishment-order-history.module.ts b/feature-libs/order/components/replenishment-order-history/replenishment-order-history.module.ts index eab4f21aa08..a4f258bd84b 100644 --- a/feature-libs/order/components/replenishment-order-history/replenishment-order-history.module.ts +++ b/feature-libs/order/components/replenishment-order-history/replenishment-order-history.module.ts @@ -15,7 +15,7 @@ import { provideDefaultConfig, UrlModule, } from '@spartacus/core'; -import { ListNavigationModule } from '@spartacus/storefront'; +import { BtnLikeLinkModule, ListNavigationModule } from '@spartacus/storefront'; import { defaultReplenishmentOrderCancellationLayoutConfig } from '../replenishment-order-details/default-replenishment-order-cancellation-layout.config'; import { ReplenishmentOrderHistoryComponent } from './replenishment-order-history.component'; @@ -26,6 +26,7 @@ import { ReplenishmentOrderHistoryComponent } from './replenishment-order-histor ListNavigationModule, UrlModule, I18nModule, + BtnLikeLinkModule, FeaturesConfigModule, ], providers: [ diff --git a/feature-libs/organization/order-approval/components/details/order-approval-detail-form/order-approval-detail-form.component.html b/feature-libs/organization/order-approval/components/details/order-approval-detail-form/order-approval-detail-form.component.html index 3efcaa29cbc..42d9e17fb27 100644 --- a/feature-libs/organization/order-approval/components/details/order-approval-detail-form/order-approval-detail-form.component.html +++ b/feature-libs/organization/order-approval/components/details/order-approval-detail-form/order-approval-detail-form.component.html @@ -85,9 +85,9 @@
diff --git a/feature-libs/organization/order-approval/components/details/order-approval-details.module.ts b/feature-libs/organization/order-approval/components/details/order-approval-details.module.ts index 9a1f75a9c9a..eff3cee80ab 100644 --- a/feature-libs/organization/order-approval/components/details/order-approval-details.module.ts +++ b/feature-libs/organization/order-approval/components/details/order-approval-details.module.ts @@ -22,7 +22,11 @@ import { OrderDetailsService, OrderOverviewComponent, } from '@spartacus/order/components'; -import { FormErrorsModule, SpinnerModule } from '@spartacus/storefront'; +import { + BtnLikeLinkModule, + FormErrorsModule, + SpinnerModule, +} from '@spartacus/storefront'; import { ApproverGuard } from '../../core/guards/approver.guard'; import { OrderApprovalDetailFormComponent } from './order-approval-detail-form/order-approval-detail-form.component'; import { OrderApprovalDetailService } from './order-approval-detail.service'; @@ -37,6 +41,7 @@ import { OrderDetailPermissionResultsComponent } from './order-detail-permission FormErrorsModule, SpinnerModule, RouterModule, + BtnLikeLinkModule, ConfigModule.withConfig({ cmsComponents: { OrderApprovalDetailTotalsComponent: { diff --git a/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.component.html b/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.component.html index ed72ab4f168..e59ed3f9a8b 100644 --- a/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.component.html +++ b/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.component.html @@ -251,6 +251,7 @@ [routerLink]="{ cxRoute: 'home' } | cxUrl" routerLinkActive="active" class="btn btn-primary btn-block" + cxBtnLikeLink >{{ 'unitLevelOrderHistory.startShopping' | cxTranslate }}
diff --git a/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.module.ts b/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.module.ts index 2d63835680b..d3778ae3a44 100644 --- a/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.module.ts +++ b/feature-libs/organization/unit-order/components/unit-level-order-history/unit-level-order-history.module.ts @@ -17,8 +17,8 @@ import { provideDefaultConfig, UrlModule, } from '@spartacus/core'; +import { BtnLikeLinkModule, ListNavigationModule } from '@spartacus/storefront'; import { UnitLevelOrdersViewerGuard } from '@spartacus/organization/unit-order/core'; -import { ListNavigationModule } from '@spartacus/storefront'; import { UnitLevelOrderHistoryFilterModule } from './filter/unit-level-order-history-filter.module'; import { UnitLevelOrderHistoryComponent } from './unit-level-order-history.component'; @@ -32,6 +32,7 @@ import { UnitLevelOrderHistoryComponent } from './unit-level-order-history.compo UrlModule, I18nModule, UnitLevelOrderHistoryFilterModule, + BtnLikeLinkModule, FeaturesConfigModule, ], declarations: [UnitLevelOrderHistoryComponent], diff --git a/feature-libs/product-configurator/common/components/configure-product/configure-product.component.html b/feature-libs/product-configurator/common/components/configure-product/configure-product.component.html index cbf2d7030c3..8d3290142af 100644 --- a/feature-libs/product-configurator/common/components/configure-product/configure-product.component.html +++ b/feature-libs/product-configurator/common/components/configure-product/configure-product.component.html @@ -32,6 +32,7 @@ }" class="btn btn-primary btn-block" cxAutoFocus + cxBtnLikeLink [attr.aria-label]=" getAriaLabelTranslationKey(product.configuratorType) | cxTranslate " diff --git a/feature-libs/product-configurator/common/components/configure-product/configure-product.module.ts b/feature-libs/product-configurator/common/components/configure-product/configure-product.module.ts index 26bfef30367..7a2b4bd0b34 100644 --- a/feature-libs/product-configurator/common/components/configure-product/configure-product.module.ts +++ b/feature-libs/product-configurator/common/components/configure-product/configure-product.module.ts @@ -15,6 +15,7 @@ import { UrlModule, } from '@spartacus/core'; import { + BtnLikeLinkModule, IconModule, OutletPosition, ProductListOutlets, @@ -37,6 +38,7 @@ import { ConfigureProductComponent } from './configure-product.component'; I18nModule, IconModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideOutlet({ diff --git a/feature-libs/storefinder/components/store-finder-components.module.ts b/feature-libs/storefinder/components/store-finder-components.module.ts index 8f4cf544b0f..4fc4b18e65e 100644 --- a/feature-libs/storefinder/components/store-finder-components.module.ts +++ b/feature-libs/storefinder/components/store-finder-components.module.ts @@ -16,6 +16,7 @@ import { } from '@spartacus/core'; import { StoreFinderCoreModule } from '@spartacus/storefinder/core'; import { + BtnLikeLinkModule, IconModule, ListNavigationModule, OutletModule, @@ -47,6 +48,7 @@ import { StoreFinderComponent } from './store-finder/store-finder.component'; IconModule, OutletModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/storefinder/components/store-finder-list-item/store-finder-list-item.component.html b/feature-libs/storefinder/components/store-finder-list-item/store-finder-list-item.component.html index b218fe067b4..73b840b7756 100644 --- a/feature-libs/storefinder/components/store-finder-list-item/store-finder-list-item.component.html +++ b/feature-libs/storefinder/components/store-finder-list-item/store-finder-list-item.component.html @@ -52,6 +52,7 @@ rel="noopener noreferrer" *cxFeature="'!a11yStyleExternalLinksAsLinks'" class="btn btn-sm btn-secondary btn-block cx-button" + cxBtnLikeLink (click)="$event.stopPropagation()" [attr.aria-label]="'storeFinder.ariaLabelGetDirections' | cxTranslate" >{{ 'storeFinder.getDirections' | cxTranslate }} {{ 'loginForm.register' | cxTranslate }} {{ 'loginForm.guestCheckout' | cxTranslate }} diff --git a/feature-libs/user/account/components/login-register/login-register.module.ts b/feature-libs/user/account/components/login-register/login-register.module.ts index 728a129feac..fdab2c2af54 100644 --- a/feature-libs/user/account/components/login-register/login-register.module.ts +++ b/feature-libs/user/account/components/login-register/login-register.module.ts @@ -15,7 +15,7 @@ import { provideDefaultConfig, UrlModule, } from '@spartacus/core'; -import { PageSlotModule } from '@spartacus/storefront'; +import { BtnLikeLinkModule, PageSlotModule } from '@spartacus/storefront'; import { LoginRegisterComponent } from './login-register.component'; @NgModule({ @@ -26,6 +26,7 @@ import { LoginRegisterComponent } from './login-register.component'; PageSlotModule, I18nModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/user/profile/components/close-account/close-account.module.ts b/feature-libs/user/profile/components/close-account/close-account.module.ts index dbcb7d9696d..2e7fc67da14 100644 --- a/feature-libs/user/profile/components/close-account/close-account.module.ts +++ b/feature-libs/user/profile/components/close-account/close-account.module.ts @@ -16,6 +16,7 @@ import { UrlModule, } from '@spartacus/core'; import { + BtnLikeLinkModule, IconModule, KeyboardFocusModule, SpinnerModule, @@ -34,6 +35,7 @@ import { CloseAccountComponent } from './components/close-account/close-account. SpinnerModule, KeyboardFocusModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/user/profile/components/close-account/components/close-account/close-account.component.html b/feature-libs/user/profile/components/close-account/components/close-account/close-account.component.html index c47bb8e922d..2651c7a9960 100644 --- a/feature-libs/user/profile/components/close-account/components/close-account/close-account.component.html +++ b/feature-libs/user/profile/components/close-account/components/close-account/close-account.component.html @@ -12,9 +12,9 @@ {{ 'common.cancel' | cxTranslate }} diff --git a/feature-libs/user/profile/components/forgot-password/forgot-password.component.html b/feature-libs/user/profile/components/forgot-password/forgot-password.component.html index 91d9dea4d77..fac4c503a5d 100644 --- a/feature-libs/user/profile/components/forgot-password/forgot-password.component.html +++ b/feature-libs/user/profile/components/forgot-password/forgot-password.component.html @@ -48,9 +48,9 @@ {{ 'common.cancel' | cxTranslate }} diff --git a/feature-libs/user/profile/components/forgot-password/forgot-password.module.ts b/feature-libs/user/profile/components/forgot-password/forgot-password.module.ts index 7131ea9a16c..559cf0e58e2 100644 --- a/feature-libs/user/profile/components/forgot-password/forgot-password.module.ts +++ b/feature-libs/user/profile/components/forgot-password/forgot-password.module.ts @@ -19,7 +19,11 @@ import { RoutingService, UrlModule, } from '@spartacus/core'; -import { FormErrorsModule, SpinnerModule } from '@spartacus/storefront'; +import { + BtnLikeLinkModule, + FormErrorsModule, + SpinnerModule, +} from '@spartacus/storefront'; import { UserPasswordFacade } from '@spartacus/user/profile/root'; import { ForgotPasswordComponentService } from './forgot-password-component.service'; import { ForgotPasswordComponent } from './forgot-password.component'; @@ -34,6 +38,7 @@ import { ForgotPasswordComponent } from './forgot-password.component'; FormErrorsModule, SpinnerModule, FeaturesConfigModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/user/profile/components/update-email/update-email.component.html b/feature-libs/user/profile/components/update-email/update-email.component.html index 636b36aefdb..38bc8201363 100644 --- a/feature-libs/user/profile/components/update-email/update-email.component.html +++ b/feature-libs/user/profile/components/update-email/update-email.component.html @@ -99,9 +99,9 @@ {{ 'common.cancel' | cxTranslate }} diff --git a/feature-libs/user/profile/components/update-email/update-email.module.ts b/feature-libs/user/profile/components/update-email/update-email.module.ts index fb769c89f3b..da91989ac59 100644 --- a/feature-libs/user/profile/components/update-email/update-email.module.ts +++ b/feature-libs/user/profile/components/update-email/update-email.module.ts @@ -22,6 +22,7 @@ import { provideDefaultConfigFactory, } from '@spartacus/core'; import { + BtnLikeLinkModule, FormErrorsModule, MessageComponentModule, PasswordVisibilityToggleModule, @@ -55,6 +56,7 @@ const myAccountV2EmailMapping: CmsConfig = { PasswordVisibilityToggleModule, FeaturesConfigModule, MessageComponentModule, + BtnLikeLinkModule, ], declarations: [UpdateEmailComponent, MyAccountV2EmailComponent], exports: [UpdateEmailComponent, MyAccountV2EmailComponent], diff --git a/feature-libs/user/profile/components/update-password/update-password.component.html b/feature-libs/user/profile/components/update-password/update-password.component.html index c5c7834deeb..42a4848e038 100644 --- a/feature-libs/user/profile/components/update-password/update-password.component.html +++ b/feature-libs/user/profile/components/update-password/update-password.component.html @@ -118,9 +118,9 @@ {{ 'common.cancel' | cxTranslate }} diff --git a/feature-libs/user/profile/components/update-password/update-password.module.ts b/feature-libs/user/profile/components/update-password/update-password.module.ts index 6513704c970..e6d43137204 100644 --- a/feature-libs/user/profile/components/update-password/update-password.module.ts +++ b/feature-libs/user/profile/components/update-password/update-password.module.ts @@ -22,6 +22,7 @@ import { provideDefaultConfigFactory, } from '@spartacus/core'; import { + BtnLikeLinkModule, FormErrorsModule, MessageComponentModule, PasswordVisibilityToggleModule, @@ -55,6 +56,7 @@ const myAccountV2PasswordMapping: CmsConfig = { PasswordVisibilityToggleModule, FeaturesConfigModule, MessageComponentModule, + BtnLikeLinkModule, ], providers: [ provideDefaultConfig({ diff --git a/feature-libs/user/profile/components/update-profile/update-profile.component.html b/feature-libs/user/profile/components/update-profile/update-profile.component.html index b3c97c9ec0c..546e2d150f1 100644 --- a/feature-libs/user/profile/components/update-profile/update-profile.component.html +++ b/feature-libs/user/profile/components/update-profile/update-profile.component.html @@ -118,9 +118,9 @@ {{ 'common.cancel' | cxTranslate }} diff --git a/feature-libs/user/profile/components/update-profile/update-profile.module.ts b/feature-libs/user/profile/components/update-profile/update-profile.module.ts index 732e88d0815..bc590267ed5 100644 --- a/feature-libs/user/profile/components/update-profile/update-profile.module.ts +++ b/feature-libs/user/profile/components/update-profile/update-profile.module.ts @@ -20,6 +20,7 @@ import { provideDefaultConfigFactory, } from '@spartacus/core'; import { + BtnLikeLinkModule, FormErrorsModule, NgSelectA11yModule, SpinnerModule, @@ -51,6 +52,7 @@ const myAccountV2ProfileMapping: CmsConfig = { NgSelectModule, NgSelectA11yModule, FeaturesConfigModule, + BtnLikeLinkModule, ], declarations: [UpdateProfileComponent, MyAccountV2ProfileComponent], exports: [UpdateProfileComponent, MyAccountV2ProfileComponent], diff --git a/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.component.html b/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.component.html index d5188e6981b..fc75ba67ec9 100644 --- a/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.component.html +++ b/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.component.html @@ -49,6 +49,7 @@

dismissDialog('Proceed To Login', reconsentEvent.errorMessage) " class="btn btn-primary" + cxBtnLikeLink autofocus >{{ 'common.submit' | cxTranslate }} diff --git a/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.module.ts b/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.module.ts index 7de3cce551d..5f180802ba0 100644 --- a/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.module.ts +++ b/integration-libs/cdc/user-account/login-form/reconsent/cdc-reconsent.module.ts @@ -8,6 +8,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { I18nModule, provideDefaultConfig } from '@spartacus/core'; import { + BtnLikeLinkModule, ConsentManagementModule, IconModule, KeyboardFocusModule, @@ -28,6 +29,7 @@ import { defaultCdcReconsentLayoutConfig } from './default-cdc-reconsent-layout. I18nModule, KeyboardFocusModule, ConsentManagementModule, + BtnLikeLinkModule, ], }) export class CdcReconsentModule { diff --git a/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.component.html b/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.component.html index 23be008b8d4..1c80b830f5f 100644 --- a/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.component.html +++ b/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.component.html @@ -16,6 +16,7 @@ " [attr.aria-label]="'cancelService.action' | cxTranslate" class="btn btn-secondary" + cxBtnLikeLink > {{ 'cancelService.action' | cxTranslate }} @@ -34,6 +35,7 @@ 'rescheduleService.actionButtonLabel' | cxTranslate " class="btn btn-secondary" + cxBtnLikeLink > {{ 'rescheduleService.actionButtonLabel' | cxTranslate }} diff --git a/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.module.ts b/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.module.ts index 1b363cb8957..ddb027c30ad 100644 --- a/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.module.ts +++ b/integration-libs/s4-service/order/components/s4-service-order-detail-actions/s4-service-order-detail-actions.module.ts @@ -14,10 +14,17 @@ import { UrlModule, } from '@spartacus/core'; import { RouterModule } from '@angular/router'; +import { BtnLikeLinkModule } from '@spartacus/storefront'; @NgModule({ declarations: [S4ServiceOrderDetailActionsComponent], - imports: [CommonModule, I18nModule, RouterModule, UrlModule], + imports: [ + CommonModule, + I18nModule, + RouterModule, + UrlModule, + BtnLikeLinkModule, + ], providers: [ provideDefaultConfig({ cmsComponents: { diff --git a/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.spec.ts b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.spec.ts new file mode 100644 index 00000000000..03ccb233b49 --- /dev/null +++ b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.spec.ts @@ -0,0 +1,83 @@ +import { Component } from '@angular/core'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { BtnLikeLinkDirective } from './btn-like-link.directive'; +import { BtnLikeLinkModule } from './btn-like-link.module'; + +export const Mock = { + clickHandler: function (_value: string) {}, +}; + +@Component({ + template: ` + + Affected Link + + + Unaffected Link 1 + + + Unaffected Link 2 + + `, +}) +class TestContainerComponent { + onClick(value: string) { + Mock.clickHandler(value); + } +} + +describe('BtnLikeLinkDirective', () => { + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [BtnLikeLinkModule], + declarations: [BtnLikeLinkDirective, TestContainerComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TestContainerComponent); + }); + + it('should react on enter and spacebar clicks', () => { + const onClickSpy = spyOn( + fixture.componentInstance, + 'onClick' + ).and.callThrough(); + const mockClickHandlerSpy = spyOn(Mock, 'clickHandler').and.callThrough(); + + const affectedLink = fixture.debugElement.query(By.css('.affected-link')); + const unaffectedLink1 = fixture.debugElement.query( + By.css('.unaffected-link:not(.btn)') + ); + const unaffectedLink2 = fixture.debugElement.query( + By.css('.unaffected-link.btn') + ); + + const event = new KeyboardEvent('keydown', { + key: ' ', + code: 'Space', + keyCode: 32, // deprecated but sometimes necessary for certain checks + charCode: 32, + bubbles: true, + }); + + affectedLink.nativeElement.dispatchEvent(event); + unaffectedLink1.nativeElement.dispatchEvent(event); + unaffectedLink2.nativeElement.dispatchEvent(event); + + fixture.detectChanges(); + + // Verify role button existance! + expect(affectedLink.attributes['role']).toBe('button'); + expect(unaffectedLink1.attributes['role']).toBe(undefined); + expect(unaffectedLink2.attributes['role']).toBe(undefined); + + expect(onClickSpy).toHaveBeenCalledTimes(1); + expect(onClickSpy).toHaveBeenCalledWith('Affected'); + expect(mockClickHandlerSpy).toHaveBeenCalledTimes(1); + expect(mockClickHandlerSpy).toHaveBeenCalledWith('Affected'); + }); +}); diff --git a/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.ts b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.ts new file mode 100644 index 00000000000..9971b2b190b --- /dev/null +++ b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.directive.ts @@ -0,0 +1,31 @@ +/* + * SPDX-FileCopyrightText: 2024 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Directive } from '@angular/core'; + +/** + * Directive used for making links styled as a buttons (using .btn class) + * act as a real buttons a11y wise (meaning making them reactive to both + * enter and spacebar clicks). + * + * Note: This is done as a11y optimization for old button like link compoennts + * and shouldn't be used other than for those. Whenever you find yourself in a need + * to be using this consider it as a good 'code smell' for using BUttons instead of links. + */ +@Directive({ + selector: 'a[cxBtnLikeLink].btn', // 'a.btn' + host: { + // Adding [tabindex] allows tab-based access to this element. + tabindex: '0', + // Adding [role] tells screen reatders that this "link" is really a "button" + role: 'button', + // Add Enter keydown click mimic native Button's behaviour + '(keydown.enter)': '$event.preventDefault() ; $event.target.click() ;', + // Add Space keydown click mimic native Button's behaviour + '(keydown.space)': '$event.preventDefault() ; $event.target.click() ;', + }, +}) +export class BtnLikeLinkDirective {} diff --git a/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.module.ts b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.module.ts new file mode 100644 index 00000000000..0ebf72357ea --- /dev/null +++ b/projects/storefrontlib/layout/a11y/btn-like-link/btn-like-link.module.ts @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2024 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { BtnLikeLinkDirective } from './btn-like-link.directive'; + +const directives = [BtnLikeLinkDirective]; + +@NgModule({ + imports: [CommonModule], + declarations: [...directives], + exports: [...directives], +}) +export class BtnLikeLinkModule {} diff --git a/projects/storefrontlib/layout/a11y/btn-like-link/index.ts b/projects/storefrontlib/layout/a11y/btn-like-link/index.ts new file mode 100644 index 00000000000..df3d7a6d3a5 --- /dev/null +++ b/projects/storefrontlib/layout/a11y/btn-like-link/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2024 SAP Spartacus team + * + * SPDX-License-Identifier: Apache-2.0 + */ + +export * from './btn-like-link.directive'; +export * from './btn-like-link.module'; diff --git a/projects/storefrontlib/layout/a11y/index.ts b/projects/storefrontlib/layout/a11y/index.ts index 77edc339ade..5b65409e0d9 100644 --- a/projects/storefrontlib/layout/a11y/index.ts +++ b/projects/storefrontlib/layout/a11y/index.ts @@ -6,3 +6,4 @@ export * from './keyboard-focus/index'; export * from './skip-link/index'; +export * from './btn-like-link';