Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/eui/changelogs/upcoming/9265.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**Accessibility**

- Added information about the empty state of `EuiBasicTable` in the table caption

Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ export const ExpandedNestedTable: Story = {
},
};

export const EmptyTable: Story = {
args: {
...Playground.args,
items: [],
noItemsMessage: 'No users found',
},
};

export const DarkMode: Story = {
tags: ['vrt-only'],
globals: { colorMode: 'dark' },
Expand Down
12 changes: 11 additions & 1 deletion packages/eui/src/components/basic_table/basic_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ export class EuiBasicTable<T extends object = any> extends Component<

let itemCountPart: React.ReactNode = null;
if (!itemCount) {
itemCountPart = this.props.noItemsMessage;
itemCountPart = `${this.props.noItemsMessage},`;
} else if (pagination && totalItemCount > 0) {
itemCountPart = (
<p>
Expand Down Expand Up @@ -671,6 +671,16 @@ export class EuiBasicTable<T extends object = any> extends Component<
default="Data table"
/>
)}
{itemCount === 0 && (
<>
{' '}
<EuiI18n
token="euiBasicTable.caption.emptyState"
default="(empty)"
/>
</>
)}
{','}
</p>
{itemCountPart}
{paginationPart}
Expand Down