From 81b8043ab49caf3178ba5694711fd3167e6045c9 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Wed, 28 Aug 2019 14:22:51 -0300 Subject: [PATCH] feat(toast): add support for scoped styles --- src/components/toast/toast.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/toast/toast.js b/src/components/toast/toast.js index bd7036bcc74..25f62c6ae5d 100644 --- a/src/components/toast/toast.js +++ b/src/components/toast/toast.js @@ -407,6 +407,14 @@ export const BToast = /*#__PURE__*/ Vue.extend({ return h() } const name = `b-toast-${this._uid}` + const $parent = this.$parent + // If scoped styles are applied, and the toast is not static, + // Make sure hte scoped style data attribute is applied + const scopeAttrs = + !this.static && $parent && $parent.$options._scopeId + ? { [`${[$parent.$options._scopeId]}`]: '' } + : {} + return h( Portal, { @@ -427,6 +435,7 @@ export const BToast = /*#__PURE__*/ Vue.extend({ staticClass: 'b-toast', class: this.bToastClasses, attrs: { + ...scopeAttrs, id: this.safeId('_toast_outer'), role: this.isHiding ? null : this.isStatus ? 'status' : 'alert', 'aria-live': this.isHiding ? null : this.isStatus ? 'polite' : 'assertive',