Skip to content

Commit 1b183c9

Browse files
committed
fix: add role to react aria taggroup when empty
1 parent 9349d12 commit 1b183c9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/@react-aria/tag/src/useTagGroup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function useTagGroup<T>(props: AriaTagGroupOptions<T>, state: ListState<T
114114

115115
return {
116116
gridProps: mergeProps(gridProps, domProps, {
117-
role: state.collection.size ? 'grid' : null,
117+
role: state.collection.size ? 'grid' : 'group',
118118
'aria-atomic': false,
119119
'aria-relevant': 'additions',
120120
'aria-live': isFocusWithin ? 'polite' : 'off',

packages/react-aria-components/stories/TagGroup.stories.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,13 @@ export const TagGroupExampleWithRemove: Story = {
111111
</TagGroup>
112112
)
113113
};
114+
115+
export const EmptyTagGroup: Story = {
116+
render: (props: TagGroupProps) => (
117+
<TagGroup {...props} aria-label="Categories" >
118+
<TagList renderEmptyState={() => 'No categories.'}>
119+
{[]}
120+
</TagList>
121+
</TagGroup>
122+
)
123+
};

0 commit comments

Comments
 (0)