Skip to content

Commit 88ea325

Browse files
authored
chore(b-form-spinbutton): add two missing props (bootstrap-vue#4784)
1 parent 92d7676 commit 88ea325

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/components/form-spinbutton/form-spinbutton.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
116116
type: Boolean,
117117
default: false
118118
},
119+
ariaLabel: {
120+
type: String,
121+
default: null
122+
},
123+
ariaControls: {
124+
type: String,
125+
default: null
126+
},
119127
labelDecrement: {
120128
type: String,
121129
default: () => getComponentConfig(NAME, 'labelDecrement')
@@ -350,7 +358,13 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
350358
}
351359
},
352360
handleStepRepeat(evt, stepper) {
361+
const { type, button } = evt || {}
353362
if (!this.disabled && !this.readonly) {
363+
/* istanbul ignore if */
364+
if (type === 'mousedown' && button) {
365+
// We only respond to left (main === 0) button clicks
366+
return
367+
}
354368
this.resetTimers()
355369
// Enable body mouseup event handler
356370
this.setMouseup(true)
@@ -374,8 +388,14 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
374388
}, delay)
375389
}
376390
},
377-
onMouseup() {
391+
onMouseup(evt) {
378392
// `<body>` listener, only enabled when mousedown starts
393+
const { type, button } = evt || {}
394+
/* istanbul ignore if */
395+
if (type === 'mouseup' && button) {
396+
// we only care about left (main === 0) mouse button click
397+
return
398+
}
379399
this.resetTimers()
380400
this.setMouseup(false)
381401
// Trigger the change event

src/components/form-spinbutton/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@
6666
"prop": "vertical",
6767
"description": "When set, renders the component with a vertical layout"
6868
},
69+
{
70+
"prop": "ariaLabel",
71+
"description": "Value to place in the `aria-label` attribute of the spinbutton"
72+
},
73+
{
74+
"prop": "ariaControls",
75+
"description": "If this component controls another component or element, set this to the ID of the controlled component or element"
76+
},
6977
{
7078
"prop": "labelIncrement",
7179
"description": "Text to be used for the `aria-label` attribute on the increment button"

0 commit comments

Comments
 (0)