Skip to content

aria-selected returned as string instead of boolean #1596

@samueil

Description

@samueil

In my setup with useCombobox hook, I get the option attributes via getItemProps() function. It returns 'aria-disabled' as a boolean, but 'aria-selected' is returned as string.
As a workaround currently i need to cast it back and forth, which is inconvenient:

{
    ...downshiftItemProps,
    "aria-selected": (downshiftItemProps["aria-selected"] as unknown as string) === "true",
}

I assume it origins from here, where it could simply be changed to
'aria-selected': index === latestState.highlightedIndex, instead of the template string.

'aria-selected': `${index === latestState.highlightedIndex}`,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions