Skip to content

Commit

Permalink
fix: center add card element creating started
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed May 1, 2022
1 parent 8394249 commit 6d4ce16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/renderer/src/routes/Tasks/TaskFormButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ const TaskFormButton: React.FC<Props> = ({ forList, onSubmit }) => {
formRef.current.reset();
}
}
setOpen(false);

return true;
},
[onSubmit]
[onSubmit, setOpen]
);

useEffect(() => {
if (isOpen) {
if (!forList && formRef.current) {
formRef?.current?.scrollIntoView({ block: "center" });
}
if (forList) {
if (inputRef.current) {
inputRef.current.focus();
Expand All @@ -64,7 +68,7 @@ const TaskFormButton: React.FC<Props> = ({ forList, onSubmit }) => {
areaRef.current.onkeypress = (e: KeyboardEvent) => {
if (e.keyCode === 10 && areaRef.current) {
e.preventDefault();
if (doSubmit(areaRef.current))
if (doSubmit(areaRef.current) && areaRef?.current?.style?.height)
areaRef.current.style.height = "inherit";
}
};
Expand Down

0 comments on commit 6d4ce16

Please sign in to comment.