fix: Fix select behaviour

This commit is contained in:
Maksim Eltyshev
2022-07-26 12:49:40 +02:00
parent 1329da3fe5
commit 5ac99c9d1d
15 changed files with 18 additions and 18 deletions
@@ -76,7 +76,7 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
useEffect(() => {
if (isOpened) {
textField.current.ref.current.select();
textField.current.ref.current.focus();
}
}, [isOpened]);
@@ -37,7 +37,7 @@ const TextFileAddModal = React.memo(({ content, onCreate, onClose }) => {
}, [content, onCreate, onClose, data]);
useEffect(() => {
nameField.current.select();
nameField.current.focus();
}, []);
return (
@@ -66,7 +66,7 @@ const DescriptionEdit = React.forwardRef(({ children, defaultValue, onUpdate },
useEffect(() => {
if (isOpened) {
field.current.ref.current.select();
field.current.ref.current.focus();
}
}, [isOpened]);
@@ -81,12 +81,12 @@ const Add = React.forwardRef(({ children, onCreate }, ref) => {
useEffect(() => {
if (isOpened) {
nameField.current.ref.current.select();
nameField.current.ref.current.focus();
}
}, [isOpened]);
useDidUpdate(() => {
nameField.current.ref.current.select();
nameField.current.ref.current.focus();
}, [selectNameFieldState]);
if (!isOpened) {
@@ -71,7 +71,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
useEffect(() => {
if (isOpened) {
field.current.ref.current.select();
field.current.ref.current.focus();
}
}, [isOpened]);