Skip to content

Bug - LabelGroup - Overflow number should check the children that are really rendered #8495

@DaoDaoNoCode

Description

@DaoDaoNoCode

Describe the problem
When you use the LabelGroup component and set some conditional rendering children of it, the overflow (show more/less) functionality will be not accurate.

How do you reproduce the problem?
https://codesandbox.io/s/lively-breeze-5n9rl3?file=/index.tsx
There are always 3 labels rendered because the 4th label is conditional, but it shows the show more button.

Expected behavior
The overflow button only counts the rendered children. If the numLabel is set to 3, then the button will only appear when there are more than 3 children rendered.

Is this issue blocking you?
A little bit.

What is your product and what release date are you targeting?
ODH/RHODS

Any other information?
The solution is when counting the children in LabelGroup component, use React.Children.toArray(children).length instead of React.Children.count(children)
I can help with this after the issue is triaged, it should be a simple fix.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions