From 6541808dcb31a96a1fe14ef7d79f531f5a36bc15 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 28 Aug 2019 13:41:39 -0300 Subject: [PATCH 1/2] feat(b-modal): add scoped style support when portalled --- src/components/modal/modal.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js index 47380d6dd38..ea4a6d43603 100644 --- a/src/components/modal/modal.js +++ b/src/components/modal/modal.js @@ -987,13 +987,20 @@ export const BModal = /*#__PURE__*/ Vue.extend({ } backdrop = h(BVTransition, { props: { noFade: this.noFade } }, [backdrop]) + // If the parent has a scoped style attribute, and the modal + // is portalled, add the scoped attribute to the modal wrapper + const $parent = this.$parent + const scopeAttrs = !this.static && $parent && $parent.$options._scopeId + ? { [`${[$parent.$options._scopeId]}`]: '' } + : {} + // Assemble modal and backdrop in an outer
return h( 'div', { key: `modal-outer-${this._uid}`, style: this.modalOuterStyle, - attrs: { ...this.$attrs, id: this.safeId('__BV_modal_outer_') } + attrs: { ...scopeAttrs, ...this.$attrs, id: this.safeId('__BV_modal_outer_') } }, [modal, backdrop] ) From 854d57333e3da26d6536f0ecab1fa3f624ae001c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 28 Aug 2019 13:44:53 -0300 Subject: [PATCH 2/2] lint --- src/components/modal/modal.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/modal/modal.js b/src/components/modal/modal.js index ea4a6d43603..987a9da0e28 100644 --- a/src/components/modal/modal.js +++ b/src/components/modal/modal.js @@ -990,9 +990,10 @@ export const BModal = /*#__PURE__*/ Vue.extend({ // If the parent has a scoped style attribute, and the modal // is portalled, add the scoped attribute to the modal wrapper const $parent = this.$parent - const scopeAttrs = !this.static && $parent && $parent.$options._scopeId - ? { [`${[$parent.$options._scopeId]}`]: '' } - : {} + const scopeAttrs = + !this.static && $parent && $parent.$options._scopeId + ? { [`${[$parent.$options._scopeId]}`]: '' } + : {} // Assemble modal and backdrop in an outer
return h(