Skip to content

Commit 697ac06

Browse files
committed
Fix review comments
1 parent 639e663 commit 697ac06

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/dialog/overflow-menu/overflow-menu-option.component.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
<button
2424
class="bx--overflow-menu-options__btn"
2525
role="menuitem"
26-
tabindex="-1"
27-
(focus)="onFocus()"
28-
(blur)="onBlur()"
26+
[tabindex]="tabIndex"
27+
(focus)="tabIndex=0"
28+
(blur)="tabIndex=-1"
2929
[disabled]="disabled"
3030
[title]="(titleEnabled ? content : '')">
3131
<ng-content></ng-content>
@@ -54,6 +54,8 @@ export class OverflowMenuOption {
5454
*/
5555
@Input() disabled = false;
5656

57+
public tabIndex = -1;
58+
5759
constructor(private elementRef: ElementRef) {}
5860

5961
/**
@@ -75,12 +77,4 @@ export class OverflowMenuOption {
7577
get content(): string {
7678
return this.elementRef.nativeElement.querySelector("button").textContent;
7779
}
78-
79-
onFocus() {
80-
this.elementRef.nativeElement.querySelector("button").tabIndex = "0";
81-
}
82-
83-
onBlur() {
84-
this.elementRef.nativeElement.querySelector("button").tabIndex = "-1";
85-
}
8680
}

src/dialog/overflow-menu/overflow-menu-pane.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export class OverflowMenuPane extends Dialog {
5656

5757
setTimeout(() => {
5858
getFocusElementList(this.elementRef.nativeElement).every(button => {
59-
if (button.tabIndex === undefined) {
59+
// Allows user to set tabindex to 0.
60+
if (button.getAttribute("tabindex") === null) {
6061
button.tabIndex = -1;
6162
}
6263
});

0 commit comments

Comments
 (0)