Skip to content

Commit a7ec38e

Browse files
authored
Disable autocorrect suggestions in combobox (#1502)
1 parent 4815ed8 commit a7ec38e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/@react-aria/combobox/src/useComboBox.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ export function useComboBox<T>(props: AriaComboBoxProps<T>, state: ComboBoxState
289289
// TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
290290
'aria-autocomplete': 'list',
291291
'aria-activedescendant': focusedItem ? getItemId(state, focusedItem.key) : undefined,
292-
onTouchEnd
292+
onTouchEnd,
293+
// This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.
294+
autoCorrect: 'off',
295+
// This disable's the macOS Safari spell check auto corrections.
296+
spellCheck: 'false'
293297
}),
294298
listBoxProps: mergeProps(menuProps, listBoxProps)
295299
};

packages/@react-spectrum/combobox/test/ComboBox.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ describe('ComboBox', function () {
144144

145145
let combobox = getByRole('combobox');
146146
expect(combobox).toHaveAttribute('placeholder', 'Select a topic...');
147+
expect(combobox).toHaveAttribute('autoCorrect', 'off');
148+
expect(combobox).toHaveAttribute('spellCheck', 'false');
149+
expect(combobox).toHaveAttribute('autoComplete', 'off');
147150

148151
let button = getByRole('button');
149152
expect(button).toHaveAttribute('aria-haspopup', 'listbox'); // i think we really want 'listbox'?

0 commit comments

Comments
 (0)