feat: 🚸 improve edit usability

pull/779/head
HannesOberreiter 2 years ago
parent 0e3bc92a61
commit 862ade29f8

@ -79,7 +79,9 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
useEffect(() => {
if (isOpened) {
field.current.ref.current.focus();
const text = field.current.ref.current;
text.focus();
text.setSelectionRange(text.value.length + 1, text.value.length + 1);
}
}, [isOpened]);

@ -70,7 +70,9 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
useEffect(() => {
if (isOpened) {
textField.current.ref.current.focus();
const text = textField.current.ref.current;
text.focus();
text.setSelectionRange(text.value.length + 1, text.value.length + 1);
}
}, [isOpened]);

@ -65,7 +65,9 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
useEffect(() => {
if (isOpened) {
field.current.ref.current.focus();
const text = field.current.ref.current;
text.focus();
text.setSelectionRange(text.value.length + 1, text.value.length + 1);
}
}, [isOpened]);

@ -71,7 +71,9 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
useEffect(() => {
if (isOpened) {
field.current.ref.current.select();
const text = field.current.ref.current;
text.focus();
text.setSelectionRange(text.value.length + 1, text.value.length + 1);
}
}, [isOpened]);

Loading…
Cancel
Save