Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/@react-aria/collections/src/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ export class ElementNode<T> extends BaseNode<T> {
node.rendered = rendered;
node.render = render;
node.value = value;
node['aria-label'] = obj['aria-label'];
node.textValue = textValue || (typeof props.children === 'string' ? props.children : '') || obj['aria-label'] || '';
if (id != null && id !== node.key) {
throw new Error('Cannot change the id of an item');
Expand Down
22 changes: 22 additions & 0 deletions packages/react-aria-components/stories/ComboBox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,25 @@ export function WithCreateOption() {
</ComboBox>
);
}

export const ComboBoxListBoxItemWithAriaLabel: ComboBoxStory = () => (
<ComboBox name="combo-box-example" data-testid="combo-box-example" allowsEmptyCollection>
<Label style={{display: 'block'}}>Test</Label>
<div style={{display: 'flex'}}>
<Input />
<Button>
<span aria-hidden="true" style={{padding: '0 2px'}}>▼</span>
</Button>
</div>
<Popover placement="bottom end">
<ListBox
renderEmptyState={renderEmptyState}
data-testid="combo-box-list-box"
className={styles.menu}>
<MyListBoxItem aria-label="Item Foo" textValue="Foo">Item <b>Foo</b></MyListBoxItem>
<MyListBoxItem aria-label="Item Bar" textValue="Bar">Item <b>Bar</b></MyListBoxItem>
<MyListBoxItem aria-label="Item Baz" textValue="Baz">Item <b>Baz</b></MyListBoxItem>
</ListBox>
</Popover>
</ComboBox>
);