From 217235fba08e0c1b470e76711a1f517d4b36747f Mon Sep 17 00:00:00 2001 From: Sagirov Eugeniy Date: Wed, 14 Sep 2022 12:12:09 +0300 Subject: [PATCH] feat: added handler for enter button --- .../author-library/LibraryAuthoringPage.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/library-authoring/author-library/LibraryAuthoringPage.jsx b/src/library-authoring/author-library/LibraryAuthoringPage.jsx index c2d52581..46c9a270 100644 --- a/src/library-authoring/author-library/LibraryAuthoringPage.jsx +++ b/src/library-authoring/author-library/LibraryAuthoringPage.jsx @@ -336,7 +336,7 @@ const deriveTypeOptions = (blockTypes, intl) => { */ const LibraryAuthoringPageHeaderBase = ({ intl, library, ...props }) => { const [inputIsActive, setIsActive] = useState(false); - const handleOnBlur = (event) => { + const handleSaveTitle = (event) => { const newTitle = event.target.value; if (newTitle && newTitle !== library.title) { props.updateLibrary({ data: { title: newTitle, libraryId: library.id } }); @@ -360,7 +360,10 @@ const LibraryAuthoringPageHeaderBase = ({ intl, library, ...props }) => { type="text" aria-label="Title input" defaultValue={library.title} - onBlur={handleOnBlur} + onBlur={handleSaveTitle} + onKeyDown={event => { + if (event.key === 'Enter') { handleSaveTitle(event) } + }} /> ) : (