From 9f619b92544ebf3fa8aad2daedc859a5e8dbc32f Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:26:11 -0300 Subject: [PATCH 1/7] fix(dropdown child components): ensure class bindings are placed on root element --- src/components/dropdown/dropdown-divider.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/dropdown/dropdown-divider.js b/src/components/dropdown/dropdown-divider.js index cedba7f0844..59d0c4202e5 100644 --- a/src/components/dropdown/dropdown-divider.js +++ b/src/components/dropdown/dropdown-divider.js @@ -12,15 +12,17 @@ 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' } }, [ + const $attrs = data.attrs || {} + delete data.attrs + return h('li', mergeData(data, { attrs: { role: 'presentation' } }), [ h( props.tag, - mergeData(data, { + { staticClass: 'dropdown-divider', attrs: { + ...$attrs, role: 'separator', 'aria-orientation': 'horizontal' }, From 522393dc1393afaa471464913266f1647073803c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:28:55 -0300 Subject: [PATCH 2/7] Update dropdown-divider.js --- src/components/dropdown/dropdown-divider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dropdown/dropdown-divider.js b/src/components/dropdown/dropdown-divider.js index 59d0c4202e5..7f49b3a352b 100644 --- a/src/components/dropdown/dropdown-divider.js +++ b/src/components/dropdown/dropdown-divider.js @@ -27,7 +27,7 @@ export const BDropdownDivider = /*#__PURE__*/ Vue.extend({ 'aria-orientation': 'horizontal' }, ref: 'divider' - }) + } ) ]) } From d70fab364ae96eced261e9a7525b3b05fd59a423 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:31:46 -0300 Subject: [PATCH 3/7] Update dropdown-divider.js --- src/components/dropdown/dropdown-divider.js | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/components/dropdown/dropdown-divider.js b/src/components/dropdown/dropdown-divider.js index 7f49b3a352b..7c48271e4ac 100644 --- a/src/components/dropdown/dropdown-divider.js +++ b/src/components/dropdown/dropdown-divider.js @@ -15,20 +15,17 @@ export const BDropdownDivider = /*#__PURE__*/ Vue.extend({ props, render(h, { props, data }) { const $attrs = data.attrs || {} - delete 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' - } - ) + h(props.tag, { + staticClass: 'dropdown-divider', + attrs: { + ...$attrs, + role: 'separator', + 'aria-orientation': 'horizontal' + }, + ref: 'divider' + }) ]) } }) From 06c6b52f567818a3c4fd86b3d248d5f475827e06 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:40:09 -0300 Subject: [PATCH 4/7] Update dropdown-form.js --- src/components/dropdown/dropdown-form.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/dropdown/dropdown-form.js b/src/components/dropdown/dropdown-form.js index 2ac2ea940f3..b1b89dad600 100644 --- a/src/components/dropdown/dropdown-form.js +++ b/src/components/dropdown/dropdown-form.js @@ -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: { @@ -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 ) ]) From 3c838cd33aa258659cc1d29a7444958cf9c3129f Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:43:29 -0300 Subject: [PATCH 5/7] Update dropdown-group.js --- src/components/dropdown/dropdown-group.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/dropdown/dropdown-group.js b/src/components/dropdown/dropdown-group.js index a44e4173e1c..94c6b638adb 100644 --- a/src/components/dropdown/dropdown-group.js +++ b/src/components/dropdown/dropdown-group.js @@ -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 @@ -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) ) ]) From 60ff046c8d6f492baa49b920a7995977eb0e0b11 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:44:49 -0300 Subject: [PATCH 6/7] Update dropdown-header.js --- src/components/dropdown/dropdown-header.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/dropdown/dropdown-header.js b/src/components/dropdown/dropdown-header.js index 6fb5458ba0b..23918836754 100644 --- a/src/components/dropdown/dropdown-header.js +++ b/src/components/dropdown/dropdown-header.js @@ -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 ) ]) From 448d045fa6325aea69441b28f9e6b98a90f41661 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 12:46:26 -0300 Subject: [PATCH 7/7] Update dropdown-text.js --- src/components/dropdown/dropdown-text.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/dropdown/dropdown-text.js b/src/components/dropdown/dropdown-text.js index 2a5982f0b7f..46dc635a105 100644 --- a/src/components/dropdown/dropdown-text.js +++ b/src/components/dropdown/dropdown-text.js @@ -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, @@ -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 ) ])