Skip to content

Commit 74ea618

Browse files
[9.2] [Search][A11y] Search application disable add selected button when error in selected indices (#241031) (#241626)
# Backport This will backport the following commits from `main` to `9.2`: - [[Search][A11y] Search application disable add selected button when error in selected indices (#241031)](#241031) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Saarika Bhasi","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-11-03T13:40:17Z","message":"[Search][A11y] Search application disable add selected button when error in selected indices (#241031)\n\n## Summary\n\nFix A11y issue. When there is an error in the search application -> add\nnew indices-> select indices combo box, add selected button should be\ndisabled.\n\n**Preconditions**\nStateful Search Applications -> Content page is opened.\nSearch application is added.\nI used Mac voice over or Screen Reader (NVDA). \n\n**To reproduce:** \n\n1. Using only keyboard Navigate to Add new indices button by pressing\nTab key.\n2. Press Enter.\n3. Navigate to Select searchable indices field.\n4. Enter any text (f.e.: test).\n5. Navigate to Add selected button.\n6. Press Enter.\n7. Observe screen reader.\n8. Press Tab key.\n9. Observe the page.\n\n### Screenshot\n<img width=\"2052\" height=\"1250\" alt=\"Screenshot 2025-10-28 at 3 51\n07 PM\"\nsrc=\"https://github.com/user-attachments/assets/c07c5c75-f3ca-47b9-ae2f-6ba2e972d103\"\n/>\n\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)","sha":"221078a04ad005ccc8e9fa3f33792839b5bf2a3c","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.3.0"],"title":"[Search][A11y] Search application disable add selected button when error in selected indices","number":241031,"url":"https://github.com/elastic/kibana/pull/241031","mergeCommit":{"message":"[Search][A11y] Search application disable add selected button when error in selected indices (#241031)\n\n## Summary\n\nFix A11y issue. When there is an error in the search application -> add\nnew indices-> select indices combo box, add selected button should be\ndisabled.\n\n**Preconditions**\nStateful Search Applications -> Content page is opened.\nSearch application is added.\nI used Mac voice over or Screen Reader (NVDA). \n\n**To reproduce:** \n\n1. Using only keyboard Navigate to Add new indices button by pressing\nTab key.\n2. Press Enter.\n3. Navigate to Select searchable indices field.\n4. Enter any text (f.e.: test).\n5. Navigate to Add selected button.\n6. Press Enter.\n7. Observe screen reader.\n8. Press Tab key.\n9. Observe the page.\n\n### Screenshot\n<img width=\"2052\" height=\"1250\" alt=\"Screenshot 2025-10-28 at 3 51\n07 PM\"\nsrc=\"https://github.com/user-attachments/assets/c07c5c75-f3ca-47b9-ae2f-6ba2e972d103\"\n/>\n\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)","sha":"221078a04ad005ccc8e9fa3f33792839b5bf2a3c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241031","number":241031,"mergeCommit":{"message":"[Search][A11y] Search application disable add selected button when error in selected indices (#241031)\n\n## Summary\n\nFix A11y issue. When there is an error in the search application -> add\nnew indices-> select indices combo box, add selected button should be\ndisabled.\n\n**Preconditions**\nStateful Search Applications -> Content page is opened.\nSearch application is added.\nI used Mac voice over or Screen Reader (NVDA). \n\n**To reproduce:** \n\n1. Using only keyboard Navigate to Add new indices button by pressing\nTab key.\n2. Press Enter.\n3. Navigate to Select searchable indices field.\n4. Enter any text (f.e.: test).\n5. Navigate to Add selected button.\n6. Press Enter.\n7. Observe screen reader.\n8. Press Tab key.\n9. Observe the page.\n\n### Screenshot\n<img width=\"2052\" height=\"1250\" alt=\"Screenshot 2025-10-28 at 3 51\n07 PM\"\nsrc=\"https://github.com/user-attachments/assets/c07c5c75-f3ca-47b9-ae2f-6ba2e972d103\"\n/>\n\n\n### Checklist\n\n- [x] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)","sha":"221078a04ad005ccc8e9fa3f33792839b5bf2a3c"}}]}] BACKPORT--> Co-authored-by: Saarika Bhasi <[email protected]>
1 parent 0d9672e commit 74ea618

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)