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

Can not set the tabindex attribute on a ngbDropdownItem #4592

Closed
Pigeo opened this issue Oct 26, 2023 · 0 comments · Fixed by #4626
Closed

Can not set the tabindex attribute on a ngbDropdownItem #4592

Pigeo opened this issue Oct 26, 2023 · 0 comments · Fixed by #4626

Comments

@Pigeo
Copy link

Pigeo commented Oct 26, 2023

Bug description:

I have the following HTML tag in the template of my Component:
<button [attr.data-cy]="'view-' + view.key" (click)="changeView(view.key)" *ngFor="let view of views" ngbDropdownItem role="menuitem" tabindex="1">

However, the HTML code in the rendered web page contains the following:
<button _ngcontent-mvw-c33="" ngbdropdownitem="" role="menuitem" tabindex="0" class="dropdown-item ng-star-inserted" data-cy="view-BASIC">

i.e. ng-boostrap has replaced my tabindex="1" with tabindex="0"

NB: the corresponding ngbDropdownToggle button has tabindex="1" and that's why I need to also have tabindex="1" on all its children ngbDropdownItems in order to have the correct expected behavior when navigating with TAB key.

Expected behavior:

Bootstrap should preserve the tabindex provided by the user - OR - it should set the tabindex of the ngbDropdownItems to the same value that the tabindex of the corresponding ngbDropdownToggle.

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-kuqznx?file=src%2Fapp%2Fdropdown-basic.html

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 15.2.8

ng-bootstrap: 14.2.0

Bootstrap: 5.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants