From 249e660896094803954d8fa164dee49e7a8c5502 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Tue, 11 May 2021 17:56:04 -0700 Subject: [PATCH 1/2] Update SchemaFieldTypeSelect to allow passing any aria props - We'll specifically be using aria-labelledby in this PR, but theoretically any aria prop should be fine. --- .../shared/schema/field_type_select/index.test.tsx | 6 ++++++ .../applications/shared/schema/field_type_select/index.tsx | 2 ++ 2 files changed, 8 insertions(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx index df28719839011..6d51a06273712 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.test.tsx @@ -39,4 +39,10 @@ describe('SchemaFieldTypeSelect', () => { expect(wrapper.find(EuiSelect).prop('disabled')).toEqual(true); }); + + it('passes arbitrary props', () => { + const wrapper = shallow(); + + expect(wrapper.find(EuiSelect).prop('aria-label')).toEqual('Test label'); + }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx index 8dfd87f4015d6..fb6c0f2047b12 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/schema/field_type_select/index.tsx @@ -23,10 +23,12 @@ export const SchemaFieldTypeSelect: React.FC = ({ fieldType, updateExistingFieldType, disabled, + ...rest }) => { const fieldTypeOptions = Object.values(SchemaType).map((type) => ({ value: type, text: type })); return ( Date: Tue, 11 May 2021 17:56:59 -0700 Subject: [PATCH 2/2] Update AS & WS schema tables to use the type table column heading as an aria-labelledby ID --- .../app_search/components/schema/components/schema_table.tsx | 5 ++++- .../components/schema/schema_fields_table.tsx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx index d9187bb65adf0..8fff01b268b12 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/schema/components/schema_table.tsx @@ -35,7 +35,9 @@ export const SchemaTable: React.FC = () => { {FIELD_NAME} - {FIELD_TYPE} + + {FIELD_TYPE} + @@ -74,6 +76,7 @@ export const SchemaTable: React.FC = () => { fieldName={fieldName} fieldType={fieldType} updateExistingFieldType={updateSchemaFieldType} + aria-labelledby="schemaFieldType" /> diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.tsx index db8a816f81cb4..0f9a91cf312e6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/schema/schema_fields_table.tsx @@ -38,7 +38,7 @@ export const SchemaFieldsTable: React.FC = () => { {SCHEMA_ERRORS_TABLE_FIELD_NAME_HEADER} - + {SCHEMA_ERRORS_TABLE_DATA_TYPE_HEADER} @@ -58,6 +58,7 @@ export const SchemaFieldsTable: React.FC = () => { fieldName={fieldName} fieldType={filteredSchemaFields[fieldName]} updateExistingFieldType={updateExistingFieldType} + aria-labelledby="schemaDataType" />