Skip to content

Commit

Permalink
fix(nbButton): allow specifying custom tabindex (#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksim-karatkevich authored Jul 29, 2020
1 parent a619c7f commit e9f84be
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/framework/theme/components/button/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ export class NbButtonComponent implements AfterViewInit {
*/
@Input() appearance: NbButtonAppearance = 'filled';

/**
* Tabindex of the button.
*/
@Input() tabIndex: number;

/**
* Sets `filled` appearance
*/
Expand Down Expand Up @@ -653,7 +658,15 @@ export class NbButtonComponent implements AfterViewInit {
// issue #794
@HostBinding('attr.tabindex')
get tabbable(): string {
return this.disabled ? '-1' : '0';
if (this.disabled) {
return '-1';
}

if (this.tabIndex == null) {
return '0';
}

return this.tabIndex.toString();
}

@HostBinding('class.size-tiny')
Expand Down

0 comments on commit e9f84be

Please sign in to comment.