Skip to content

Commit

Permalink
fix(VRangeSlider): do not emit change twice if thumb was dragged
Browse files Browse the repository at this point in the history
fixes #7915
  • Loading branch information
dsseng committed Aug 7, 2019
1 parent 0df2dc0 commit 6e4f083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vuetify/src/components/VRangeSlider/VRangeSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ export default VSlider.extend({
},
onSliderClick (e: MouseEvent) {
if (!this.isActive) {
if (this.noClick) {
this.noClick = false
return
}

// It doesn't seem to matter if we focus on the wrong thumb here
const thumb = this.$refs.thumb_1 as HTMLElement
thumb.focus()
Expand Down
6 changes: 6 additions & 0 deletions packages/vuetify/src/components/VSlider/VSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default mixins<options &
isFocused: false,
isActive: false,
lazyValue: 0,
noClick: false, // Prevent click event if dragging took place, hack for #7915
}),

computed: {
Expand Down Expand Up @@ -473,6 +474,7 @@ export default mixins<options &
this.$emit('end', this.internalValue)
if (!deepEqual(this.oldValue, this.internalValue)) {
this.$emit('change', this.internalValue)
this.noClick = true
}

this.isActive = false
Expand All @@ -495,6 +497,10 @@ export default mixins<options &
this.keyPressed = 0
},
onSliderClick (e: MouseEvent) {
if (this.noClick) {
this.noClick = false
return
}
const thumb = this.$refs.thumb as HTMLElement
thumb.focus()

Expand Down

0 comments on commit 6e4f083

Please sign in to comment.