WTTJ/welcome-ui

Tag - remove role listitem on component

liv7c opened this issue · 0 comments

liv7c commented

For which component/foundations?

Tag

Prioritization

Low 🏖️

Description

Currently, every Tag has by default a role of listitem. This means that when using a Tag component, it has to be wrapped inside of an element with the role of list (a ul or an ol) . Otherwise, the role listitem is invalid (https://www.w3.org/TR/wai-aria-1.2/#listitem).

In some cases (like using only one Tag), it does not make sense to have to wrap it inside of a list or for the tag to be a list item.

The explicit role also overrides any implicit role that the element Tag might have when the user passes the as prop. It is not good practice to override the role manually with another role when in this case, the implicit role might be sufficient.

[Tech] Implementation

The change would be to remove the hardcoded attribute role="listitem" (https://github.com/WTTJ/welcome-ui/blob/master/packages/Tag/src/index.tsx#L72)

Due Date

No response