Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(b-form-spinbutton): prevent double increment/decrement on mobile (fixes #4838) #4842

Merged
merged 6 commits into from Feb 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/components/form-spinbutton/form-spinbutton.js
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
}
}
Expand Down