Skip to content

Commit 221078a

Browse files
authored
[Search][A11y] Search application disable add selected button when error in selected indices (elastic#241031)
## Summary Fix A11y issue. When there is an error in the search application -> add new indices-> select indices combo box, add selected button should be disabled. **Preconditions** Stateful Search Applications -> Content page is opened. Search application is added. I used Mac voice over or Screen Reader (NVDA). **To reproduce:** 1. Using only keyboard Navigate to Add new indices button by pressing Tab key. 2. Press Enter. 3. Navigate to Select searchable indices field. 4. Enter any text (f.e.: test). 5. Navigate to Add selected button. 6. Press Enter. 7. Observe screen reader. 8. Press Tab key. 9. Observe the page. ### Screenshot <img width="2052" height="1250" alt="Screenshot 2025-10-28 at 3 51 07 PM" src="https://github.com/user-attachments/assets/c07c5c75-f3ca-47b9-ae2f-6ba2e972d103" /> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
1 parent 3829dd2 commit 221078a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

x-pack/solutions/search/plugins/enterprise_search/public/applications/applications/components/search_application/add_indices_flyout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
import React, { useCallback, useMemo } from 'react';
8+
import React, { useCallback, useMemo, useState } from 'react';
99

1010
import { useActions, useValues } from 'kea';
1111

@@ -63,6 +63,8 @@ export const AddIndicesFlyout: React.FC<AddIndicesFlyoutProps> = ({ onClose }) =
6363
[setSelectedIndices]
6464
);
6565

66+
const [isIndicesSelectComboBoxDisabled, setIndicesSelectComboBoxDisabled] =
67+
useState<boolean>(false);
6668
return (
6769
<EuiFlyout onClose={onClose} aria-labelledby={modalTitleId}>
6870
<EuiFlyoutHeader hasBorder>
@@ -102,6 +104,7 @@ export const AddIndicesFlyout: React.FC<AddIndicesFlyoutProps> = ({ onClose }) =
102104
'xpack.enterpriseSearch.searchApplications.searchApplication.indices.addIndicesFlyout.selectableLabel',
103105
{ defaultMessage: 'Select searchable indices' }
104106
)}
107+
setIndicesSelectComboBoxDisabled={setIndicesSelectComboBoxDisabled}
105108
/>
106109
</EuiFlyoutBody>
107110
<EuiFlyoutFooter>
@@ -113,6 +116,7 @@ export const AddIndicesFlyout: React.FC<AddIndicesFlyoutProps> = ({ onClose }) =
113116
data-telemetry-id="entSearchApplications-indices-addNewIndices-submit"
114117
iconType="plusInCircle"
115118
onClick={submitSelectedIndices}
119+
disabled={isIndicesSelectComboBoxDisabled}
116120
>
117121
{i18n.translate(
118122
'xpack.enterpriseSearch.searchApplications.searchApplication.indices.addIndicesFlyout.submitButton',

x-pack/solutions/search/plugins/enterprise_search/public/applications/applications/components/search_applications/components/indices_select_combobox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,22 @@ export type IndicesSelectComboBoxProps = Omit<
3737
'data-telemetry-id'?: string;
3838
ignoredOptions?: string[];
3939
label?: string;
40+
setIndicesSelectComboBoxDisabled?: (isInvalid: boolean) => void;
4041
};
4142

42-
export const IndicesSelectComboBox = ({ ignoredOptions, ...props }: IndicesSelectComboBoxProps) => {
43+
export const IndicesSelectComboBox = ({
44+
setIndicesSelectComboBoxDisabled,
45+
ignoredOptions,
46+
...props
47+
}: IndicesSelectComboBoxProps) => {
4348
const [searchQuery, setSearchQuery] = useState<string | undefined>(undefined);
4449
const { makeRequest } = useActions(FetchIndicesForSearchApplicationsAPILogic);
4550
const { status, data } = useValues(FetchIndicesForSearchApplicationsAPILogic);
4651
const isInvalid = Boolean(searchQuery && !props.selectedOptions?.length);
52+
useEffect(() => {
53+
if (!setIndicesSelectComboBoxDisabled) return;
54+
setIndicesSelectComboBoxDisabled(isInvalid);
55+
}, [isInvalid]);
4756

4857
useEffect(() => {
4958
makeRequest({ searchQuery });

0 commit comments

Comments
 (0)