Skip to content

Wrong (outdated) type definition for DropDownGroup and SelectGroup? #11507

@ancorgs

Description

@ancorgs

Describe the problem
This is an issue with Patternfly 6 (at least)

The label property of MenuGroup is declared as type ReactNode. It can indeed handle that and we use it at Agama.

But in the case of DropDownGroup and SelectGroup the properties label are defined as type string. They can actually handle everything that MenuGroup's label can handle (eg. see agama-project/agama#1977).

Internally SelectGroup is using MenuGroup. So the limitation doesn't make fully sense to me, although it could be intentional for some reason I'm overlooking.

MenuGroup#label was an string until two years ago, #8219 and the component itself was added 5 years ago e867f09 While the SelectGroup#label types dates from 6 years ago. All that makes me think that those types were simply left behind by omission.

How do you reproduce the problem?

See agama-project/agama#1977

Expected behavior

Type check does not fail when a ReactNode is used as label for DropDownGroup or SelectGroup.

Is this issue blocking you?

The workarounds are to disable type checking for that file or to use a Menu instead of a DropDown. Both doable but annoying.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions