From 7c186082ef6c37fe8f23936e2c6807c68901ff37 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 16 Nov 2021 10:27:44 +0000 Subject: [PATCH] Merge pull request #5789 from overleaf/hb-fix-cursor-jump-share-modal Prevent cursor jumping in share modal input GitOrigin-RevId: e3c88e4ff91bc9a83e8ac781305d0a34f198911c --- .../components/select-collaborators.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js b/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js index 5c0e2c0e56..be3829a916 100644 --- a/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js +++ b/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js @@ -84,11 +84,6 @@ export default function SelectCollaborators({ itemToString: item => item && item.name, onStateChange: ({ inputValue, type, selectedItem }) => { switch (type) { - // set inputValue when the input changes - case useCombobox.stateChangeTypes.InputChange: - setInputValue(inputValue) - break - // add a selected item on Enter (keypress), click or blur case useCombobox.stateChangeTypes.InputKeyDownEnter: case useCombobox.stateChangeTypes.ItemClick: @@ -177,6 +172,9 @@ export default function SelectCollaborators({ addNewItem(inputValue, false) } }, + onChange: e => { + setInputValue(e.target.value) + }, onKeyDown: event => { switch (event.key) { case 'Enter':