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-6857) - Footer tabbing fix #18777

Merged
merged 8 commits into from
May 15, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
[style]="node.styleAttributes"
[class]="node.styleClasses"
(click)="closeIfClickedTheSameLink(node)"
[tabindex]="depth > 0 && !node.children ? -1 : 0"
[tabindex]="getTabIndex(node, depth)"
(focus)="depth || reinitializeMenu()"
(keydown.space)="toggleOpen($any($event))"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,5 +385,17 @@ describe('Navigation UI Component', () => {
navigationComponent['arrowControls'].next(arrowUpEvent);
expect(document.activeElement).toEqual(firstChild.nativeElement);
});

it('should restore default tabbing order for non flyout navigation', () => {
const childNode = {
title: 'Child',
url: '/child',
};
navigationComponent.flyout = true;
expect(navigationComponent.getTabIndex(childNode, 1)).toEqual(-1);

navigationComponent.flyout = false;
expect(navigationComponent.getTabIndex(childNode, 1)).toEqual(0);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,14 @@ export class NavigationUIComponent implements OnInit, OnDestroy {

this.isOpen = this.openNodes.length > 0;
}

/**
* Resores default tabbing order for non flyout navigation.
*/
getTabIndex(node: NavigationNode, depth: number): 0 | -1 {
if (!this.flyout) {
return 0;
}
return depth > 0 && !node?.children ? -1 : 0;
}
}