diff --git a/client/modules/IDE/components/CollectionList/CollectionListRow.jsx b/client/modules/IDE/components/CollectionList/CollectionListRow.jsx index 91c4bd59fe..c646b2dcb7 100644 --- a/client/modules/IDE/components/CollectionList/CollectionListRow.jsx +++ b/client/modules/IDE/components/CollectionList/CollectionListRow.jsx @@ -129,9 +129,6 @@ const CollectionListRowBase = (props) => { closeAll(); setRenameOpen(true); setRenameValue(props.collection.name); - if (renameInput.current) { - renameInput.current.focus(); - } }; const handleRenameChange = (e) => { @@ -146,6 +143,12 @@ const CollectionListRowBase = (props) => { } }; + const handleRenameFocus = () => { + if (renameInput.current) { + renameInput.current.focus(); + } + }; + const handleRenameBlur = () => { updateName(); closeAll(); @@ -191,7 +194,10 @@ const CollectionListRowBase = (props) => { onKeyDown={handleRenameEnter} onBlur={handleRenameBlur} onClick={(e) => e.stopPropagation()} - ref={renameInput} + ref={(node) => { + renameInput.current = node; + handleRenameFocus(); + }} /> )}