Skip to content

Commit

Permalink
fix: allow dir to be managed across multiple connections and disconne…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
Westbrook Johnson authored and Westbrook committed Apr 21, 2022
1 parent e0044d2 commit 6d93170
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/base/src/Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ export function SpectrumMixin<T extends Constructor<ReactiveElement>>(
(dirParent as unknown as ShadowRoot)
.host) as HTMLElement;
}
const oldDir = this.dir;
this.dir =
dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';
if (oldDir === this.dir) {
this.setAttribute('dir', this.dir);
}
if (dirParent === document.documentElement) {
observedForElements.add(this);
} else {
Expand Down

0 comments on commit 6d93170

Please # to comment.