diff --git a/packages/eui/changelogs/upcoming/7842.md b/packages/eui/changelogs/upcoming/7842.md new file mode 100644 index 00000000000..9418340cd39 --- /dev/null +++ b/packages/eui/changelogs/upcoming/7842.md @@ -0,0 +1,2 @@ +- Updated `EuiComboBox` to no longer autocomplete searched text when used within forms + diff --git a/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap b/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap index 1c51c90c320..8ae9eb118a9 100644 --- a/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap +++ b/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap @@ -25,6 +25,7 @@ exports[`EuiComboBox renders 1`] = ` aria-expanded="false" aria-invalid="false" aria-label="aria-label" + autocomplete="off" class="euiComboBox__input" data-test-subj="comboBoxSearchInput" id="generated-id__eui-combobox-id" @@ -82,6 +83,7 @@ exports[`EuiComboBox renders the options list dropdown 1`] = ` aria-controls="generated-id_listbox" aria-expanded="true" aria-invalid="false" + autocomplete="off" class="euiComboBox__input" data-test-subj="comboBoxSearchInput" id="generated-id__eui-combobox-id" diff --git a/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsx b/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsx index 2b60ad1d59d..c610773be86 100644 --- a/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsx +++ b/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsx @@ -368,6 +368,7 @@ export class EuiComboBoxInput extends Component< placeholder={showPlaceholder ? placeholder : undefined} value={this.searchValue} autoFocus={autoFocus} + autoComplete="off" // Force the menu to re-open on every input click - only necessary when plain text onClick={this.asPlainText ? (onFocus as any) : undefined} // Type shenanigans - event should be mostly the same />