Skip to content

Commit

Permalink
fix(VSlider): wrong tick labels positions in RTL mode (#11317)
Browse files Browse the repository at this point in the history
fixes #11028
  • Loading branch information
jacekkarczmarczyk committed May 4, 2020
1 parent 239e238 commit 225e82a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/components/VSlider/VSlider.sass
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@
transform: translateX(0%)

+rtl()
transform: translateX(100%)
transform: translateX(0%)

&:last-child .v-slider__tick-label
+ltr()
transform: translateX(-100%)

+rtl()
transform: translateX(0%)
transform: translateX(100%)

.v-slider__tick-label
top: 8px
Expand Down
11 changes: 5 additions & 6 deletions packages/vuetify/src/components/VSlider/VSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,12 @@ export default mixins<options &

const tickSize = parseFloat(this.tickSize)
const range = createRange(this.numTicks + 1)
const direction = this.vertical ? 'bottom' : 'left'
const offsetDirection = this.vertical ? 'right' : 'top'
const direction = this.vertical ? 'bottom' : (this.$vuetify.rtl ? 'right' : 'left')
const offsetDirection = this.vertical ? (this.$vuetify.rtl ? 'left' : 'right') : 'top'

if (this.vertical) range.reverse()

const ticks = range.map(i => {
const index = this.$vuetify.rtl ? this.maxValue - i : i
const ticks = range.map(index => {
const children = []

if (this.tickLabels[index]) {
Expand All @@ -329,11 +328,11 @@ export default mixins<options &
}, this.tickLabels[index]))
}

const width = i * (100 / this.numTicks)
const width = index * (100 / this.numTicks)
const filled = this.$vuetify.rtl ? (100 - this.inputWidth) < width : width < this.inputWidth

return this.$createElement('span', {
key: i,
key: index,
staticClass: 'v-slider__tick',
class: {
'v-slider__tick--filled': filled,
Expand Down

0 comments on commit 225e82a

Please sign in to comment.