Skip to content
Permalink
Browse files
fix(b-form-spinbutton): prevent double increment/decrement on mobile (f…
…ixes #4838) (#4842)
  • Loading branch information
tmorehouse committed Feb 26, 2020
1 parent 6308a0f commit 9c2c700a91d7a6e57572f579f68996eaceda5c00
Showing 1 changed file with 5 additions and 4 deletions.
@@ -366,8 +366,6 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
return
}
this.resetTimers()
// Enable body mouseup event handler
this.setMouseup(true)
// Step the counter initially
stepper(1)
const threshold = this.computedThreshold
@@ -393,9 +391,10 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
const { type, button } = evt || {}
/* istanbul ignore if */
if (type === 'mouseup' && button) {
// we only care about left (main === 0) mouse button click
// Ignore non left button (main === 0) mouse button click
return
}
evt.preventDefault()
this.resetTimers()
this.setMouseup(false)
// Trigger the change event
@@ -437,8 +436,10 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
props: { scale: this.hasFocus ? 1.5 : 1.25 },
attrs: { 'aria-hidden': 'true' }
})
const handler = evt => /* istanbul ignore next: until tests written */ {
const handler = evt => {
if (!isDisabled && !isReadonly) {
evt.preventDefault()
this.setMouseup(true)
this.handleStepRepeat(evt, stepper)
}
}

0 comments on commit 9c2c700

Please sign in to comment.