mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
prevent Enter key from submitting form during autocomplete selection (#7221)
This commit is contained in:
@@ -317,9 +317,15 @@ const NewRequest = ({ collectionUid, item, isEphemeral, onClose }) => {
|
||||
className="bruno-form"
|
||||
onSubmit={formik.handleSubmit}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
formik.handleSubmit();
|
||||
if (e.key === 'Enter' && !e.defaultPrevented) {
|
||||
const isTextInput
|
||||
= ['input', 'textarea'].includes(e.target.tagName.toLowerCase())
|
||||
|| e.target.isContentEditable;
|
||||
|
||||
if (!isTextInput) {
|
||||
e.preventDefault();
|
||||
formik.handleSubmit();
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user