Skip to content

Commit

Permalink
Merge pull request #670 from akto-api-security/feature/add_support_fo…
Browse files Browse the repository at this point in the history
…r_enter_key

add support for enter key on create collection
  • Loading branch information
notshivansh authored Oct 23, 2023
2 parents 2292a75 + 4846aaa commit 87424e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function ApiCollections() {
}}
>
<Modal.Section>

<div onKeyDown={(e) => func.handleKeyPress(e, createNewCollection)}>
<TextField
id={"new-collection-input"}
label="Name"
Expand All @@ -167,7 +167,7 @@ function ApiCollections() {
)}
autoFocus
/>

</div>

</Modal.Section>
</Modal>)
Expand Down
7 changes: 7 additions & 0 deletions apps/dashboard/web/polaris_web/web/src/util/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,13 @@ getSizeOfFile(bytes) {
}
return duration.trim();
},
handleKeyPress (event, funcToCall) {
const enterKeyPressed = event.keyCode === 13;
if (enterKeyPressed) {
event.preventDefault();
funcToCall();
}
}
}

export default func

0 comments on commit 87424e4

Please sign in to comment.