Skip to content

CounterLabel doesn't work for non-string children #2837

Closed
@dwilsonactual

Description

@dwilsonactual

Description

On the search results page (e.g.) we use the <CounterLabel> element, which is rendering "([object Object])":

<span class="_VisuallyHidden__VisuallyHidden-sc-11jhm7a-0 rTZSs">&nbsp;([object Object])</span>

Which is not great.

CounterLabel should render this correctly or be updated to only accept string children.

Steps to reproduce

We use CounterLabel like this

    <CounterLabel data-testid="resolved-count-label" sx={{height: 20, lineHeight: '20px', py: 0, px: 2}}>
      <Count isLowerBound={resultCountIsLowerBound} value={totalResults} />
    </CounterLabel>

But CounterLabel has code that renders this:

<VisuallyHidden>&nbsp;{`(${children})`}</VisuallyHidden>

Which doesn't work for children that aren't simple strings.

Version

35.18.0

Browser

Chrome, Safari, Firefox, Edge, iOS Safari

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions