Skip to content

Commit 72d60b9

Browse files
authored
Merge branch 'dev' into fix-form-group-fieldset-accessibility
2 parents 2a8f3cb + 37ec7e9 commit 72d60b9

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

src/components/form-checkbox/form-checkbox.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,19 @@ export const BFormCheckbox = /*#__PURE__*/ Vue.extend({
102102
}
103103
this.computedLocalChecked = localChecked
104104

105-
// Change is only emitted on user interaction
106-
this.$emit('change', localChecked)
105+
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
106+
this.$nextTick(() => {
107+
// Change is only emitted on user interaction
108+
this.$emit('change', localChecked)
107109

108-
// If this is a child of `<form-checkbox-group>`,
109-
// we emit a change event on it as well
110-
if (this.isGroup) {
111-
this.bvGroup.$emit('change', localChecked)
112-
}
110+
// If this is a child of `<form-checkbox-group>`,
111+
// we emit a change event on it as well
112+
if (this.isGroup) {
113+
this.bvGroup.$emit('change', localChecked)
114+
}
113115

114-
this.$emit('update:indeterminate', indeterminate)
116+
this.$emit('update:indeterminate', indeterminate)
117+
})
115118
},
116119
setIndeterminate(state) {
117120
// Indeterminate only supported in single checkbox mode

src/components/form-radio/form-radio.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ export const BFormRadio = /*#__PURE__*/ Vue.extend({
3131
}
3232
},
3333
computed: {
34-
// Radio Groups can only have a single value, so determining if checked is simple
3534
isChecked() {
3635
return looseEqual(this.value, this.computedLocalChecked)
3736
},
38-
// Flags for form-radio-check mixin
3937
isRadio() {
4038
return true
4139
},
@@ -44,21 +42,30 @@ export const BFormRadio = /*#__PURE__*/ Vue.extend({
4442
}
4543
},
4644
watch: {
47-
// Radio Groups can only have a single value, so our watchers are simple
48-
computedLocalChecked() {
49-
this.$emit('input', this.computedLocalChecked)
45+
computedLocalChecked(newValue, oldValue) {
46+
if (!looseEqual(newValue, oldValue)) {
47+
this.$emit('input', newValue)
48+
}
5049
}
5150
},
5251
methods: {
5352
handleChange({ target: { checked } }) {
54-
const value = this.value
53+
const { value } = this
54+
const localChecked = checked ? value : null
55+
5556
this.computedLocalChecked = value
56-
// Change is only emitted on user interaction
57-
this.$emit('change', checked ? value : null)
58-
// If this is a child of form-radio-group, we emit a change event on it as well
59-
if (this.isGroup) {
60-
this.bvGroup.$emit('change', checked ? value : null)
61-
}
57+
58+
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
59+
this.$nextTick(() => {
60+
// Change is only emitted on user interaction
61+
this.$emit('change', localChecked)
62+
63+
// If this is a child of `<form-radio-group>`,
64+
// we emit a change event on it as well
65+
if (this.isGroup) {
66+
this.bvGroup.$emit('change', localChecked)
67+
}
68+
})
6269
}
6370
}
6471
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy