Skip to content

Commit

Permalink
fix(slider): prevent focus when disabled (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and GitHub Enterprise committed Dec 3, 2020
1 parent 3c64db8 commit b7ac7ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions projects/ng-aquila/src/slider/slider.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ describe('NxSliderComponent', () => {
// value of disabled slider should not have changed
expect(sliderInstance.value).toBe(42);
expect(sliderNativeElement.hasAttribute('aria-disabled')).toBe(true);
expect(sliderNativeElement.tabIndex).toBe(-1);
expect(sliderNativeElement.classList).toContain('nx-slider--disabled');
});
});
Expand Down
2 changes: 1 addition & 1 deletion projects/ng-aquila/src/slider/slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class NxSliderComponent implements ControlValueAccessor, AfterViewInit, O
this._changeDetectorRef.markForCheck();
}
get tabindex(): number {
return this._tabIndex;
return this._disabled ? -1 : this._tabIndex;
}

private _min: number = DEFAULT_MIN;
Expand Down

0 comments on commit b7ac7ef

Please sign in to comment.