Skip to content

Commit

Permalink
feat(toast): add support for scoped styles (#3963)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorehouse authored and jacobmllr95 committed Aug 28, 2019
1 parent 77ad6b9 commit ca1b5de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/toast/toast.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -407,6 +407,14 @@ export const BToast = /*#__PURE__*/ Vue.extend({
return h() return h()
} }
const name = `b-toast-${this._uid}` 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( return h(
Portal, Portal,
{ {
Expand All @@ -427,6 +435,7 @@ export const BToast = /*#__PURE__*/ Vue.extend({
staticClass: 'b-toast', staticClass: 'b-toast',
class: this.bToastClasses, class: this.bToastClasses,
attrs: { attrs: {
...scopeAttrs,
id: this.safeId('_toast_outer'), id: this.safeId('_toast_outer'),
role: this.isHiding ? null : this.isStatus ? 'status' : 'alert', role: this.isHiding ? null : this.isStatus ? 'status' : 'alert',
'aria-live': this.isHiding ? null : this.isStatus ? 'polite' : 'assertive', 'aria-live': this.isHiding ? null : this.isStatus ? 'polite' : 'assertive',
Expand Down

0 comments on commit ca1b5de

Please sign in to comment.