Skip to content

Commit

Permalink
[core] fix(OverflowList): improve spacer width check (#5168)
Browse files Browse the repository at this point in the history
Co-authored-by: Dylan Cooke <[email protected]>
  • Loading branch information
dylanrcooke and Dylan Cooke authored Mar 16, 2022
1 parent 29e5e98 commit 0336971
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/components/overflow-list/overflowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class OverflowList<T> extends React.Component<OverflowListProps<T>, IOver
/** A cache containing the widths of all elements being observed to detect growing/shrinking */
private previousWidths = new Map<Element, number>();

private spacer: Element | null = null;
private spacer: HTMLElement | null = null;

public componentDidMount() {
this.repartition(false);
Expand Down Expand Up @@ -255,7 +255,7 @@ export class OverflowList<T> extends React.Component<OverflowListProps<T>, IOver
overflow: [],
visible: this.props.items,
}));
} else if (this.spacer.getBoundingClientRect().width < 0.9) {
} else if (this.spacer.offsetWidth < 0.9) {
// spacer has flex-shrink and width 1px so if it's much smaller then we know to shrink
this.setState(state => {
if (state.visible.length <= this.props.minVisibleItems!) {
Expand Down

1 comment on commit 0336971

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[core] fix(OverflowList): improve spacer width check (#5168)

Previews: documentation | landing | table | modern colors demo

Please sign in to comment.