fix: Added onKeyDown function for input field (#6699)

* Added onKeyDown function for input field

* Updated CreateOrganization.jsx
This commit is contained in:
Surendran 2023-06-15 13:32:33 +05:30 committed by GitHub
parent 6308f4292c
commit 6e249bc540
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,13 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
}
};
const handleKeyDown = (e) => {
if (e.keyCode === 13) {
e.preventDefault();
createOrganization();
}
};
const handleInputChange = (e) => {
const value = e.target.value;
setErrorText('');
@ -62,6 +69,7 @@ export const CreateOrganization = ({ showCreateOrg, setShowCreateOrg }) => {
<input
type="text"
onChange={handleInputChange}
onKeyDown={handleKeyDown}
className="form-control"
placeholder={t('header.organization.workspaceName', 'workspace name')}
disabled={isCreating}