Merge pull request #5789 from overleaf/hb-fix-cursor-jump-share-modal

Prevent cursor jumping in share modal input

GitOrigin-RevId: e3c88e4ff91bc9a83e8ac781305d0a34f198911c
This commit is contained in:
Alf Eaton
2021-11-16 10:27:44 +00:00
committed by Copybot
parent 561ce1cbc3
commit 20a07acf5c

View File

@@ -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':