Skip to content

Commit

Permalink
fix(esl-footnotes): fix esl-tooltip related to the note does not perc…
Browse files Browse the repository at this point in the history
…eive dir and lang of original content
  • Loading branch information
dshovchko committed Jul 13, 2023
1 parent bc30d41 commit e506d0d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/modules/esl-footnotes/core/esl-note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ export class ESLNote extends ESLBaseElement {
return ESLMediaQuery.for(ignore);
}

/** The text writing directionality of the element */
protected get currentDir(): string {
return getComputedStyle(this).direction;
}

/** The base language of the element */
protected get currentLang(): string {
const el = this.closest('[lang]');
return (el) ? (el as HTMLElement).lang : '';
}

@ready
protected override connectedCallback(): void {
this.init();
Expand Down Expand Up @@ -208,6 +219,8 @@ export class ESLNote extends ESLBaseElement {
activator: this,
containerEl,
html: this.html,
dir: this.currentDir,
lang: this.currentLang,
intersectionMargin: this.intersectionMargin
}, ...params);
}
Expand Down
6 changes: 6 additions & 0 deletions src/modules/esl-tooltip/core/esl-tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export interface TooltipActionParams extends PopupActionParams {
text?: string;
/** html content to be shown */
html?: string;
/** text directionality of tooltips content */
dir?: string;
/** language of tooltips text content */
lang?: string;
/** tooltip without arrow */
disableArrow?: boolean;
}
Expand Down Expand Up @@ -92,6 +96,8 @@ export class ESLTooltip extends ESLPopup {
if (params.html) {
this.innerHTML = params.html;
}
this.dir = params.dir || '';
this.lang = params.lang || '';
if (params.extraClass) {
CSSClassUtils.add(this, params.extraClass);
}
Expand Down

0 comments on commit e506d0d

Please sign in to comment.