From 613396dab5db9134c927cf33e633f88e1c488246 Mon Sep 17 00:00:00 2001 From: Jedr Blaszyk Date: Fri, 22 Nov 2024 15:00:07 +0100 Subject: [PATCH] [A11y] Fix space button clearing the index name input (#201349) ## Summary Let's just disallow space input as index names can't contain spaces anyway. This fixes an a11y issue raised recently. Fix (im clicking space a lot in the vid): https://github.com/user-attachments/assets/bdf3217a-2869-4814-8243-900c348e24fb ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [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/packages/kbn-i18n/README.md) - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --- .../components/connector_detail/attach_index_box.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/attach_index_box.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/attach_index_box.tsx index 8b5bb17020ac0..5a2e279026bda 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/attach_index_box.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connector_detail/attach_index_box.tsx @@ -222,6 +222,12 @@ export const AttachIndexBox: React.FC = ({ connector }) => )} isLoading={isLoading} options={groupedOptions} + onKeyDown={(event) => { + // Index name should not contain spaces + if (event.key === ' ') { + event.preventDefault(); + } + }} onSearchChange={(searchValue) => { setQuery({ isFullMatch: options.some((option) => option.label === searchValue),