[Discover] Fix a11y description for the search input in fields sidebar (#150887)

Missed cleaning that up in https://github.com/elastic/kibana/pull/148547
This commit is contained in:
Julia Rechkunova 2023-02-10 16:18:09 +01:00 committed by GitHub
parent cc82c49b0a
commit 0912777cfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -14,7 +14,6 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiPageSideBar_Deprecated as EuiPageSideBar,
htmlIdGenerator,
} from '@elastic/eui';
import { isOfAggregateQueryType } from '@kbn/es-query';
import { DataViewPicker } from '@kbn/unified-search-plugin/public';
@ -45,8 +44,6 @@ import { getUiActions } from '../../../../kibana_services';
import { getRawRecordType } from '../../utils/get_raw_record_type';
import { RecordRawType } from '../../services/discover_data_state_container';
const fieldSearchDescriptionId = htmlIdGenerator()();
export interface DiscoverSidebarProps extends DiscoverSidebarResponsiveProps {
/**
* Show loading instead of the field list if processing
@ -326,7 +323,6 @@ export function DiscoverSidebarComponent({
<FieldListGrouped
{...fieldListGroupedProps}
renderFieldItem={renderFieldItem}
screenReaderDescriptionId={fieldSearchDescriptionId}
localStorageKeyPrefix="discover"
/>
) : (

View file

@ -290,6 +290,19 @@ describe('discover responsive sidebar', function () {
expect(ExistingFieldsServiceApi.loadFieldExisting).toHaveBeenCalledTimes(1);
});
it('should set a11y attributes for the search input in the field list', async function () {
const comp = await mountComponent(props);
const a11yDescription = findTestSubject(comp, 'fieldListGrouped__ariaDescription');
expect(a11yDescription.prop('aria-live')).toBe('polite');
expect(a11yDescription.text()).toBe(
'1 selected field. 4 popular fields. 3 available fields. 20 empty fields. 2 meta fields.'
);
const searchInput = findTestSubject(comp, 'fieldListFiltersFieldSearch');
expect(searchInput.first().prop('aria-describedby')).toBe(a11yDescription.prop('id'));
});
it('should not have selected fields if no columns selected', async function () {
const propsWithoutColumns = {
...props,