Skip to content

Commit

Permalink
fix(Chip): update tooltip vis when chip updates (#9819)
Browse files Browse the repository at this point in the history
* fix(Chip): enable tooltip when chip updates

* fix casting
  • Loading branch information
kmcfaul authored Nov 16, 2023
1 parent a816ddd commit 18c140a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-core/src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ class Chip extends React.Component<ChipProps, ChipState> {
});
}

componentDidUpdate(_prevProps: ChipProps, prevState: ChipState) {
const nextIsTooltipVisible = Boolean(
this.span.current && this.span.current.offsetWidth < this.span.current.scrollWidth
);
if (prevState.isTooltipVisible !== nextIsTooltipVisible) {
this.setState({
isTooltipVisible: nextIsTooltipVisible
});
}
}

setChipStyle = () => ({
[cssChipTextMaxWidth.name]: this.props.textMaxWidth
});
Expand Down

0 comments on commit 18c140a

Please sign in to comment.