Skip to content

Commit

Permalink
fix: (CXSPA-8764) - Cropped focus ring (SAP#19579)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pio-Bar authored Nov 22, 2024
1 parent 30b4e7f commit c4d4d14
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class CartItemListComponent implements OnInit, OnDestroy {
useFeatureStyles('a11yPreventHorizontalScroll');
useFeatureStyles('a11yQTY2Quantity');
useFeatureStyles('a11yPickupOptionsTabs');
useFeatureStyles('a11yCroppedFocusRing');
}

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class CartItemComponent implements OnChanges {
constructor(protected cartItemContextSource: CartItemContextSource) {
useFeatureStyles('a11yCartItemsLinksStyles');
useFeatureStyles('a11yQTY2Quantity');
useFeatureStyles('a11yCroppedFocusRing');
}

ngOnChanges(changes?: SimpleChanges) {
Expand Down
5 changes: 5 additions & 0 deletions feature-libs/cart/base/styles/components/_cart-item-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
grid-template-columns: 5rem 14rem;
gap: 1rem;
text-indent: 0;
@include forFeature('a11yCroppedFocusRing') {
a {
height: fit-content;
}
}
}

.cx-name {
Expand Down
3 changes: 3 additions & 0 deletions feature-libs/cart/base/styles/components/_cart-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
display: block;
padding: 0 1vw;
height: 100%;
@include forFeature('a11yCroppedFocusRing') {
height: unset;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class ListComponent<T = any, P = PaginationModel> {
useFeatureStyles('a11yListOversizedFocus');
useFeatureStyles('a11yOrganizationLinkableCells');
useFeatureStyles('a11yTextSpacingAdjustments');
useFeatureStyles('a11yCroppedFocusRing');
}

@HostBinding('class')
Expand Down
7 changes: 7 additions & 0 deletions feature-libs/organization/administration/styles/_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
}
}
}

@include forFeature('a11yCroppedFocusRing') {
.header h2 button {
outline-offset: -2px;
}
}
@include forFeature('a11yOrganizationListHeadingOrder') {
.title {
h2,
Expand All @@ -99,6 +105,7 @@
button {
border: none;
background-color: inherit;

cx-icon {
pointer-events: none;
color: var(--cx-color, var(--cx-color-info));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
*/

import { Component } from '@angular/core';
import { ICON_TYPE } from '@spartacus/storefront';
import { useFeatureStyles } from '@spartacus/core';
import { FutureStockFacade } from '@spartacus/product/future-stock/root';
import { ICON_TYPE } from '@spartacus/storefront';

@Component({
selector: 'cx-future-stock-accordion',
Expand All @@ -17,7 +18,9 @@ export class FutureStockAccordionComponent {
expanded: boolean = false;
iconType = ICON_TYPE;

constructor(protected futureStockService: FutureStockFacade) {}
constructor(protected futureStockService: FutureStockFacade) {
useFeatureStyles('a11yCroppedFocusRing');
}

toggle(): void {
this.expanded = !this.expanded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ cx-future-stock-accordion {
border: none;
background-color: transparent;
padding-inline-start: 1.25rem;
@include forFeature('a11yCroppedFocusRing') {
padding-inline-start: unset;
margin-inline-start: 1.25rem;
padding: 0;
}
margin: 0.5rem auto;
cursor: pointer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
inject,
OnInit,
} from '@angular/core';
import { CxDatePipe, TranslationService } from '@spartacus/core';
import {
CxDatePipe,
TranslationService,
useFeatureStyles,
} from '@spartacus/core';
import { QuoteCoreConfig } from '@spartacus/quote/core';
import {
FocusConfig,
Expand Down Expand Up @@ -44,6 +48,10 @@ export class QuoteConfirmDialogComponent implements OnInit {

confirmationContext$: Observable<ConfirmationContext>;

constructor() {
useFeatureStyles('a11yCroppedFocusRing');
}

ngOnInit(): void {
this.confirmationContext$ = this.launchDialogService.data$.pipe(
filter((data) => !!data),
Expand Down
3 changes: 3 additions & 0 deletions feature-libs/quote/styles/_quote-confirm-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

button.close {
padding-inline-end: 0px;
@include forFeature('a11yCroppedFocusRing') {
padding: 0;
}
}
@include cx-highContrastTheme {
background-color: var(--cx-color-background);
Expand Down
4 changes: 4 additions & 0 deletions feature-libs/quote/styles/mixins/_quote-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
user-select: none;
margin-bottom: 1rem;

@include forFeature('a11yCroppedFocusRing') {
width: fit-content;
}

cx-icon {
padding-inline-end: 5px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,13 @@ export interface FeatureTogglesInterface {
*/
a11yShowDownArrowOnFocusedSelectMenu?: boolean;

/**
* Fixes various instances of the focus ring being cropped in the UI.
* The focus ring on interactive elements should have all its sides visible and not include any extra padding.
* Affects styles of: 'CartItemListComponent, CartItemComponent, ListComponent, FutureStockAccordionComponent, QuoteConfirmDialogComponent, MessagingComponent
*/
a11yCroppedFocusRing?: boolean;

/**
* Fixes text formatting issues while a11y text spacing is enabled.
* Affects: ListComponent, CSAgentLoginFormComponent
Expand Down Expand Up @@ -907,6 +914,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yDeleteButton2First: false,
a11yShowLabelOfSelect: false,
a11yShowDownArrowOnFocusedSelectMenu: false,
a11yCroppedFocusRing: false,
a11yTextSpacingAdjustments: false,
a11yTableHeaderReadout: false,
occCartNameAndDescriptionInHttpRequestBody: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ if (environment.cpq) {
a11yDeleteButton2First: true,
a11yShowLabelOfSelect: true,
a11yShowDownArrowOnFocusedSelectMenu: true,
a11yCroppedFocusRing: true,
a11yTextSpacingAdjustments: true,
a11yTableHeaderReadout: true,
cmsBottomHeaderSlotUsingFlexStyles: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
UntypedFormGroup,
Validators,
} from '@angular/forms';
import { WindowRef } from '@spartacus/core';
import { useFeatureStyles, WindowRef } from '@spartacus/core';
import { Observable } from 'rxjs';
import { ICON_TYPE } from '../../../../cms-components/misc/icon/icon.model';
import { FilesFormValidators } from '../../../services/file/files-form-validators';
Expand Down Expand Up @@ -94,7 +94,9 @@ export class MessagingComponent implements OnInit, AfterViewChecked {
constructor(
protected windowRef: WindowRef,
protected filesFormValidators: FilesFormValidators
) {}
) {
useFeatureStyles('a11yCroppedFocusRing');
}

ngOnInit(): void {
this.buildForm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@
90%
);
border-radius: 0px 16px 16px 16px;
@include forFeature('a11yCroppedFocusRing') {
outline-offset: -2px;
}
}

.cx-message-right-align-text {
padding: 20px 28px;
border: 1px solid var(--cx-color-light);
background-color: var(--cx-color-background);
border-radius: 0px 16px 16px 16px;
@include forFeature('a11yCroppedFocusRing') {
outline-offset: -2px;
}
}

.cx-attachment {
Expand Down

0 comments on commit c4d4d14

Please sign in to comment.