Skip to content

Commit

Permalink
fix(slider): hide ticks when slider is disabled (#2687)
Browse files Browse the repository at this point in the history
* fix(slider): hide ticks when slider is disabled

* No longer shows the ticks on hover, when the slider is disabled.

* Address feedback
  • Loading branch information
devversion authored and mmalerba committed Jan 20, 2017
1 parent 416f56f commit e9ec8ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/demo-app/slider/slider-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>Slider with Min and Max</h1>
<input [(ngModel)]="max">

<h1>Disabled Slider</h1>
<md-slider disabled [(ngModel)]="disabledValue"></md-slider>
<md-slider disabled [(ngModel)]="disabledValue" [tickInterval]="1"></md-slider>
<input [(ngModel)]="disabledValue">

<h1>Slider with set value</h1>
Expand Down
8 changes: 7 additions & 1 deletion src/lib/slider/slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ md-slider {
transition: opacity $swift-ease-out-duration $swift-ease-out-timing-function;
}

// TODO(mmalerba): Simplify css to avoid unnecessary selectors.
.md-slider-disabled .md-slider-ticks {
opacity: 0;
}

.md-slider-thumb-container {
position: absolute;
z-index: 1;
Expand Down Expand Up @@ -127,8 +132,9 @@ md-slider {
}


// Slider with ticks.
// Slider with ticks when not disabled.
.md-slider-has-ticks {

.md-slider-wrapper::after {
content: '';
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class MdSliderChange {
'[class.md-slider-thumb-label-showing]': 'thumbLabel',
'[class.md-slider-vertical]': 'vertical',
'[class.md-slider-min-value]': '_isMinValue',
'[class.md-slider-hide-last-tick]': '_isMinValue && _thumbGap && invertAxis',
'[class.md-slider-hide-last-tick]': '_isMinValue && _thumbGap && invertAxis || disabled',
},
templateUrl: 'slider.html',
styleUrls: ['slider.css'],
Expand Down

0 comments on commit e9ec8ab

Please sign in to comment.