Skip to content

Commit

Permalink
make sure that texLabelEl is available before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijbet committed Apr 4, 2024
1 parent 1786200 commit fa45f6c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/calcite-components/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,14 @@ export class Combobox
textLabelEl.offsetWidth < textLabelEl.scrollWidth ? textLabelEl.innerText : null;
};

private setTextLabelEl = (el: HTMLSpanElement): void => {
this.textLabelEl = el;

if (el) {
this.setTooltipText();
}
};

private setTextInputWrapEl = (el: HTMLInputElement): void => {
this.textInput = el;

Expand Down Expand Up @@ -1127,6 +1135,7 @@ export class Combobox
this.updateActiveItemIndex(-1);
this.resetText();
this.filterItems("");
this.setTooltipText();
}
}

Expand Down Expand Up @@ -1579,7 +1588,7 @@ export class Combobox
"label--icon": !!selectedItem?.icon,
}}
key="label"
ref={(el) => (this.textLabelEl = el)}
ref={this.setTextLabelEl}
>
{selectedItem.textLabel}
</span>
Expand Down

0 comments on commit fa45f6c

Please sign in to comment.