From 0cbfcf9a2d350aa063d86cf6d5b0ac4dff323caf Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Mon, 31 Jan 2022 16:36:01 +0530 Subject: [PATCH] Fixes issues with release modal *close , autofocus , keyboard actions (#2032) --- frontend/src/Editor/AppVersionsManager.jsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/src/Editor/AppVersionsManager.jsx b/frontend/src/Editor/AppVersionsManager.jsx index 4b03c135d0..03892a8c76 100644 --- a/frontend/src/Editor/AppVersionsManager.jsx +++ b/frontend/src/Editor/AppVersionsManager.jsx @@ -54,7 +54,7 @@ export const AppVersionsManager = function AppVersionsManager({ appVersionService .create(appId, versionName, createAppVersionFrom.id) .then(() => { - setShowModal(false); + closeModal(); toast.success('Version Created'); appVersionService.getAll(appId).then((data) => { @@ -148,8 +148,20 @@ const CreateVersionModal = function CreateVersionModal({ appVersions, showCreateVersionModalPrompt, }) { + const handleKeyPress = (event) => { + if (event.key === 'Enter') { + // eslint-disable-next-line no-undef + createVersion(versionName, createAppVersionFrom); + } + }; return ( - + setShowModal(false)} + >
@@ -160,6 +172,8 @@ const CreateVersionModal = function CreateVersionModal({ placeholder="Enter version name" disabled={isCreatingVersion} value={versionName} + autoFocus={true} + onKeyPress={(e) => handleKeyPress(e)} />