From 3e2bcd9f5e2c22fabf54cf2c6845432f6f48bf0a Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Mon, 19 Aug 2024 15:47:53 +0300 Subject: [PATCH 1/3] [EuiFieldSearch] update clear button `aria-label` --- .../form/field_search/field_search.tsx | 70 +++++++++++-------- .../__snapshots__/search_bar.test.tsx.snap | 2 +- .../__snapshots__/selectable.test.tsx.snap | 2 +- .../selectable_search.test.tsx.snap | 2 +- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/packages/eui/src/components/form/field_search/field_search.tsx b/packages/eui/src/components/form/field_search/field_search.tsx index 33bcc8e3348..db6cf0f40fe 100644 --- a/packages/eui/src/components/form/field_search/field_search.tsx +++ b/packages/eui/src/components/form/field_search/field_search.tsx @@ -8,6 +8,7 @@ import React, { Component, InputHTMLAttributes, KeyboardEvent } from 'react'; import classNames from 'classnames'; +import { EuiI18n } from '../../i18n'; import { Browser } from '../../../services/browser'; import { CommonProps } from '../../common'; @@ -256,36 +257,47 @@ export class EuiFieldSearchClass extends Component< ]; return ( - - - this.onKeyUp(e, incremental, onSearch)} - disabled={disabled} - ref={this.setRef} - {...rest} - /> - - + {(clearSearchButtonLabel: string) => ( + + + this.onKeyUp(e, incremental, onSearch)} + disabled={disabled} + ref={this.setRef} + {...rest} + /> + + + )} + ); } } diff --git a/packages/eui/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap b/packages/eui/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap index 2799498afc5..08c3a91eca2 100644 --- a/packages/eui/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap +++ b/packages/eui/src/components/search_bar/__snapshots__/search_bar.test.tsx.snap @@ -119,7 +119,7 @@ exports[`SearchBar render - provided query, filters 1`] = ` class="euiFormControlLayoutIcons emotion-euiFormControlLayoutIcons-absolute-right" >