Skip to content

Commit ca1b5de

Browse files
tmorehousejacobmllr95
authored andcommitted
feat(toast): add support for scoped styles (#3963)
1 parent 77ad6b9 commit ca1b5de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/toast/toast.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ export const BToast = /*#__PURE__*/ Vue.extend({
407407
return h()
408408
}
409409
const name = `b-toast-${this._uid}`
410+
const $parent = this.$parent
411+
// If scoped styles are applied, and the toast is not static,
412+
// Make sure hte scoped style data attribute is applied
413+
const scopeAttrs =
414+
!this.static && $parent && $parent.$options._scopeId
415+
? { [`${[$parent.$options._scopeId]}`]: '' }
416+
: {}
417+
410418
return h(
411419
Portal,
412420
{
@@ -427,6 +435,7 @@ export const BToast = /*#__PURE__*/ Vue.extend({
427435
staticClass: 'b-toast',
428436
class: this.bToastClasses,
429437
attrs: {
438+
...scopeAttrs,
430439
id: this.safeId('_toast_outer'),
431440
role: this.isHiding ? null : this.isStatus ? 'status' : 'alert',
432441
'aria-live': this.isHiding ? null : this.isStatus ? 'polite' : 'assertive',

0 commit comments

Comments
 (0)