Skip to content

Commit 18c140a

Browse files
authored
fix(Chip): update tooltip vis when chip updates (#9819)
* fix(Chip): enable tooltip when chip updates * fix casting
1 parent a816ddd commit 18c140a

File tree

1 file changed

+11
-0
lines changed
  • packages/react-core/src/components/Chip

1 file changed

+11
-0
lines changed

packages/react-core/src/components/Chip/Chip.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ class Chip extends React.Component<ChipProps, ChipState> {
8181
});
8282
}
8383

84+
componentDidUpdate(_prevProps: ChipProps, prevState: ChipState) {
85+
const nextIsTooltipVisible = Boolean(
86+
this.span.current && this.span.current.offsetWidth < this.span.current.scrollWidth
87+
);
88+
if (prevState.isTooltipVisible !== nextIsTooltipVisible) {
89+
this.setState({
90+
isTooltipVisible: nextIsTooltipVisible
91+
});
92+
}
93+
}
94+
8495
setChipStyle = () => ({
8596
[cssChipTextMaxWidth.name]: this.props.textMaxWidth
8697
});

0 commit comments

Comments
 (0)