Skip to content

Commit ccfb5b1

Browse files
johnrazeurpi0
authored andcommitted
fix(checkbox,radio): update HTML markup for BS4 (bootstrap-vue#1539)
* add for attribute in form-checkbox.js for bootstrap beta-3 * update form-radio.js for bootstrap beta-3
1 parent 760ff66 commit ccfb5b1

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export default {
5656

5757
const description = h(
5858
t.is_ButtonMode ? 'span' : 'label',
59-
{ class: t.is_ButtonMode ? null : (t.is_Plain ? 'form-check-label' : 'custom-control-label') },
59+
{
60+
class: t.is_ButtonMode ? null : (t.is_Plain ? 'form-check-label' : 'custom-control-label'),
61+
attrs: { for: t.is_ButtonMode ? null : t.safeId() }
62+
},
6063
[t.$slots.default]
6164
)
6265

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,31 @@ export default {
3232
}
3333
)
3434

35-
let indicator = h(false)
36-
if (!t.is_ButtonMode && !t.is_Plain) {
37-
indicator = h('span', { class: 'custom-control-indicator', attrs: { 'aria-hidden': 'true' } })
38-
}
39-
4035
const description = h(
41-
'span',
42-
{ class: t.is_ButtonMode ? null : (t.is_Plain ? 'form-check-description' : 'custom-control-description') },
36+
t.is_ButtonMode ? 'span' : 'label',
37+
{
38+
class: t.is_ButtonMode ? null : (t.is_Plain ? 'form-check-label' : 'custom-control-label'),
39+
attrs: { for: t.is_ButtonMode ? null : t.safeId() }
40+
},
4341
[ t.$slots.default ]
4442
)
4543

46-
const label = h(
47-
'label',
48-
{ class: [ t.is_ButtonMode ? t.buttonClasses : t.is_Plain ? 'form-check-label' : t.labelClasses ] },
49-
[ input, indicator, description ]
50-
)
51-
52-
if (t.is_Plain && !t.is_ButtonMode) {
53-
return h('div', { class: ['form-check', {'form-check-inline': !t.is_Stacked}] }, [ label ])
44+
if (!t.is_ButtonMode) {
45+
return h(
46+
'div',
47+
{ class: [
48+
t.is_Plain ? 'form-check' : t.labelClasses,
49+
{ 'form-check-inline': t.is_Plain && !t.is_Stacked },
50+
{ 'custom-control-inline': !t.is_Plain && !t.is_Stacked }
51+
] },
52+
[input, description]
53+
)
5454
} else {
55-
return label
55+
return h(
56+
'label',
57+
{ class: [t.buttonClasses] },
58+
[input, description]
59+
)
5660
}
5761
},
5862
watch: {

0 commit comments

Comments
 (0)