diff --git a/src/components/Button/validateSubmitShortcut/index.ts b/src/components/Button/validateSubmitShortcut/index.ts index 58995252c20a..29ba071c25f2 100644 --- a/src/components/Button/validateSubmitShortcut/index.ts +++ b/src/components/Button/validateSubmitShortcut/index.ts @@ -1,7 +1,5 @@ import type ValidateSubmitShortcut from './types'; -const IGNORED_NODE_NAMES = ['TEXTAREA', 'INPUT']; - /** * Validate if the submit shortcut should be triggered depending on the button state * @@ -13,9 +11,7 @@ const IGNORED_NODE_NAMES = ['TEXTAREA', 'INPUT']; const validateSubmitShortcut: ValidateSubmitShortcut = (isDisabled, isLoading, event) => { const eventTarget = event?.target as HTMLElement; - - // If the event target node is for an input, such as when there's a stray "Enter" event from an autocomplete input, then ignore it because it's not meant for this button - if (isDisabled || isLoading || IGNORED_NODE_NAMES.includes(eventTarget.nodeName) || (eventTarget?.contentEditable === 'true' && eventTarget.ariaMultiLine)) { + if (isDisabled || isLoading || eventTarget.nodeName === 'TEXTAREA' || (eventTarget?.contentEditable === 'true' && eventTarget.ariaMultiLine)) { return false; }