Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(b-dropdown-*): ensure class bindings are placed on root element for all dropdown sub-components (closes #4022) #4024

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

Merged
merged 9 commits into from
Sep 5, 2019
Merged
25 changes: 12 additions & 13 deletions src/components/dropdown/dropdown-divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ export const props = {
export const BDropdownDivider = /*#__PURE__*/ Vue.extend({
name: 'BDropdownDivider',
functional: true,
inheritAttrs: false,
props,
render(h, { props, data }) {
return h('li', { attrs: { role: 'presentation' } }, [
h(
props.tag,
mergeData(data, {
staticClass: 'dropdown-divider',
attrs: {
role: 'separator',
'aria-orientation': 'horizontal'
},
ref: 'divider'
})
)
const $attrs = data.attrs || {}
data.attrs = {}
return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [
h(props.tag, {
staticClass: 'dropdown-divider',
attrs: {
...$attrs,
role: 'separator',
'aria-orientation': 'horizontal'
},
ref: 'divider'
})
])
}
})
15 changes: 10 additions & 5 deletions src/components/dropdown/dropdown-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { BForm, props as formProps } from '../form/form'
export const BDropdownForm = /*#__PURE__*/ Vue.extend({
name: 'BDropdownForm',
functional: true,
inheritAttrs: false,
props: {
...formProps,
disabled: {
Expand All @@ -14,20 +13,26 @@ export const BDropdownForm = /*#__PURE__*/ Vue.extend({
}
},
render(h, { props, data, children }) {
return h('li', { attrs: { role: 'presentation' } }, [
const $attrs = data.attrs || {}
const $listeners = data.on || {}
data.attrs = {}
data.on = {}
return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [
h(
BForm,
mergeData(data, {
{
ref: 'form',
staticClass: 'b-dropdown-form',
class: { disabled: props.disabled },
props,
attrs: {
...$attrs,
disabled: props.disabled,
// Tab index of -1 for keyboard navigation
tabindex: props.disabled ? null : '-1'
}
}),
},
on: $listeners
},
children
)
])
Expand Down
10 changes: 6 additions & 4 deletions src/components/dropdown/dropdown-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ export const props = {
export const BDropdownGroup = /*#__PURE__*/ Vue.extend({
name: 'BDropdownGroup',
functional: true,
inheritAttrs: false,
props,
render(h, { props, data, slots, scopedSlots }) {
const $slots = slots()
const $scopedSlots = scopedSlots || {}
const $attrs = data.attrs || {}
data.attrs = {}
let header
let headerId = null

Expand All @@ -62,18 +63,19 @@ export const BDropdownGroup = /*#__PURE__*/ Vue.extend({
.join(' ')
.trim()

return h('li', { attrs: { role: 'presentation' } }, [
return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [
header || h(),
h(
'ul',
mergeData(data, {
{
staticClass: 'list-unstyled',
attrs: {
...$attrs,
id: props.id || null,
role: 'group',
'aria-describedby': adb || null
}
}),
},
normalizeSlot('default', {}, $scopedSlots, $slots)
)
])
Expand Down
10 changes: 6 additions & 4 deletions src/components/dropdown/dropdown-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@ export const props = {
export const BDropdownHeader = /*#__PURE__*/ Vue.extend({
name: 'BDropdownHeader',
functional: true,
inheritAttrs: false,
props,
render(h, { props, data, children }) {
return h('li', { attrs: { role: 'presentation' } }, [
const $attrs = data.attrs || {}
data.attrs = {}
return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [
h(
props.tag,
mergeData(data, {
{
staticClass: 'dropdown-header',
class: {
[`text-${props.variant}`]: props.variant
},
attrs: {
...$attrs,
id: props.id || null,
role: 'heading'
},
ref: 'header'
}),
},
children
)
])
Expand Down
10 changes: 6 additions & 4 deletions src/components/dropdown/dropdown-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { mergeData } from 'vue-functional-data-merge'
export const BDropdownText = /*#__PURE__*/ Vue.extend({
name: 'BDropdownText',
functional: true,
inheritAttrs: false,
props: {
tag: {
type: String,
Expand All @@ -17,17 +16,20 @@ export const BDropdownText = /*#__PURE__*/ Vue.extend({
}
},
render(h, { props, data, children }) {
return h('li', { attrs: { role: 'presentation' } }, [
const $attrs = data.attrs || {}
data.attrs = {}
return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [
h(
props.tag,
mergeData(data, {
{
staticClass: 'b-dropdown-text',
class: {
[`text-${props.variant}`]: props.variant
},
props,
attrs: $attrs,
ref: 'text'
}),
},
children
)
])
Expand Down