Skip to content

Commit

Permalink
feat(b-modal): add scoped style support when portalled (non-static mo…
Browse files Browse the repository at this point in the history
…dal) (#3962)
  • Loading branch information
tmorehouse committed Aug 28, 2019
1 parent 0d1961c commit 77ad6b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,21 @@ 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 <div>
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]
)
Expand Down

0 comments on commit 77ad6b9

Please sign in to comment.