Skip to content

Commit 7490e8a

Browse files
[TableListView] Fix table scope issues (#82105) (#82452)
* [TableListView] Fix table scope issues * Replace the default tableCaption with another one that describes what the table does * Make the accessibility props required in order to always add them in the future Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent e937618 commit 7490e8a

5 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.js.snap

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugins/dashboard/public/application/listing/dashboard_listing.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export class DashboardListing extends React.Component {
4343
<I18nProvider>
4444
<TableListView
4545
headingId="dashboardListingHeading"
46+
rowHeader="title"
4647
createItem={this.props.hideWriteControls ? null : this.props.createItem}
4748
findItems={this.props.findItems}
4849
deleteItems={this.props.hideWriteControls ? null : this.props.deleteItems}
@@ -61,6 +62,9 @@ export class DashboardListing extends React.Component {
6162
tableListTitle={i18n.translate('dashboard.listing.dashboardsTitle', {
6263
defaultMessage: 'Dashboards',
6364
})}
65+
tableCaption={i18n.translate('dashboard.listing.dashboardsTitle', {
66+
defaultMessage: 'Dashboards',
67+
})}
6468
toastNotifications={this.props.core.notifications.toasts}
6569
uiSettings={this.props.core.uiSettings}
6670
searchFilters={

src/plugins/kibana_react/public/table_list_view/table_list_view.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ export interface TableListViewProps {
6666
* If the table is not empty, this component renders its own h1 element using the same id.
6767
*/
6868
headingId?: string;
69+
/**
70+
* Indicates which column should be used as the identifying cell in each row.
71+
*/
72+
rowHeader: string;
73+
/**
74+
* Describes the content of the table. If not specified, the caption will be "This table contains {itemCount} rows."
75+
*/
76+
tableCaption: string;
6977
searchFilters?: SearchFilterConfig[];
7078
}
7179

@@ -471,6 +479,8 @@ class TableListView extends React.Component<TableListViewProps, TableListViewSta
471479
search={search}
472480
sorting={true}
473481
data-test-subj="itemsInMemTable"
482+
rowHeader={this.props.rowHeader}
483+
tableCaption={this.props.tableCaption}
474484
/>
475485
);
476486
}

src/plugins/visualize/public/application/components/visualize_listing.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ export const VisualizeListing = () => {
154154
// we allow users to create visualizations even if they can't save them
155155
// for data exploration purposes
156156
createItem={createNewVis}
157+
tableCaption={i18n.translate('visualize.listing.table.listTitle', {
158+
defaultMessage: 'Visualizations',
159+
})}
157160
findItems={fetchItems}
158161
deleteItems={visualizeCapabilities.delete ? deleteItems : undefined}
159162
editItem={visualizeCapabilities.save ? editItem : undefined}
160163
tableColumns={tableColumns}
161164
listingLimit={listingLimit}
162165
initialPageSize={savedObjectsPublic.settings.getPerPage()}
163166
initialFilter={''}
167+
rowHeader="title"
164168
noItemsFragment={noItemsFragment}
165169
entityName={i18n.translate('visualize.listing.table.entityName', {
166170
defaultMessage: 'visualization',

x-pack/plugins/graph/public/components/listing.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export function Listing(props: ListingProps) {
3131
return (
3232
<I18nProvider>
3333
<TableListView
34+
tableCaption={i18n.translate('xpack.graph.listing.graphsTitle', {
35+
defaultMessage: 'Graphs',
36+
})}
3437
headingId="graphListingHeading"
38+
rowHeader="title"
3539
createItem={props.capabilities.save ? props.createItem : undefined}
3640
findItems={props.findItems}
3741
deleteItems={props.capabilities.delete ? props.deleteItems : undefined}

0 commit comments

Comments
 (0)