Skip to content

Commit

Permalink
[A11y] Fix space button clearing the index name input (elastic#201349)
Browse files Browse the repository at this point in the history
## 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)
  • Loading branch information
jedrazb authored Nov 22, 2024
1 parent 2046663 commit 613396d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ export const AttachIndexBox: React.FC<AttachIndexBoxProps> = ({ 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),
Expand Down

0 comments on commit 613396d

Please sign in to comment.