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-9028) - Search dropdown first option visible focus #19741

Merged
merged 7 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ export class QuickOrderFormComponent implements OnInit, OnDestroy {

// Focus on first index moving to last
if (results.length) {
if (
this.featureConfigService.isEnabled(
'a11ySearchableDropdownFirstElementFocus'
)
) {
this.winRef.document
.querySelector('main')
?.classList.remove('mouse-focus');
}
if (focusedIndex >= results.length - 1) {
results[0].focus();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,12 @@ export interface FeatureTogglesInterface {
*/
a11yAddPaddingToCarouselPanel?: boolean;

/**
* Search dropdowns will display the focus ring correctly when navigating to the options using the down arrow key.
* Affects: SearchBoxComponent, QuickOrderFormComponent
*/
a11ySearchableDropdownFirstElementFocus?: boolean;

/**
* Hides the 'Consent Management' button from the tab order when the cookies banner is visible.
* Ensures the button is re-enabled and part of the tab order once consent is given and the banner disappears.
Expand Down Expand Up @@ -1063,6 +1069,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yQuickOrderSearchBoxRefocusOnClose: false,
a11yKeyboardFocusInSearchBox: false,
a11yAddPaddingToCarouselPanel: false,
a11ySearchableDropdownFirstElementFocus: false,
a11yHideConsentButtonWhenBannerVisible: false,
occCartNameAndDescriptionInHttpRequestBody: false,
cmsBottomHeaderSlotUsingFlexStyles: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ if (environment.cpq) {
a11yQuickOrderSearchBoxRefocusOnClose: true,
a11yKeyboardFocusInSearchBox: true,
a11yAddPaddingToCarouselPanel: true,
a11ySearchableDropdownFirstElementFocus: true,
a11yHideConsentButtonWhenBannerVisible: true,
cmsBottomHeaderSlotUsingFlexStyles: true,
useSiteThemeService: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,15 @@ export class SearchBoxComponent implements OnInit, OnDestroy {
];
// Focus on first index moving to last
if (results.length) {
if (
this.featureConfigService?.isEnabled(
'a11ySearchableDropdownFirstElementFocus'
)
) {
this.winRef.document
.querySelector('header')
?.classList.remove('mouse-focus');
}
if (focusedIndex >= results.length - 1) {
results[0].focus();
} else {
Expand Down
Loading