Skip to content

Duplicate key in Tabs list when label is a node instead of a string #195

@slafayIGN

Description

@slafayIGN

In the Tabs component, the label can be a node instead of a simple string.

But the way the key is computed : https://github.com/codegouvfr/react-dsfr/blob/main/src/Tabs.tsx#L160

  <li key={label + (iconId ?? "")} role="presentation">

may give the <li> a non unique [object Object] key.

I encountered this when putting labels inside <span> .

Wouldn't it be a better option to choose the tabIndex as the key ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions