File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed
Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 } ) ;
You can’t perform that action at this time.
0 commit comments