Skip to content

Commit 56202c8

Browse files
committed
When you press reply, scroll to the new comment box and also focus it
1 parent e1bcdd3 commit 56202c8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/goals/NewComment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default function NewComment({ updateId }: { updateId: string }) {
8787
<div className="min-w-0 flex-1">
8888
<form onSubmit={handleSubmit(onSubmit)}>
8989
<TextArea
90+
id={`new-comment-${updateId}`}
9091
ref={register({ required: true })}
9192
label="Comment"
9293
name="description"

src/components/goals/UpdateComment.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { User } from 'src/pages/members'
1616
import { useMutation, useQueryClient } from 'react-query'
1717
import toast from 'react-hot-toast'
1818
import ListModal from '../modal/ListModal'
19+
import { scrollToContentWithId } from 'src/utils'
1920

2021
export type GoalUpdateType = {
2122
id: string
@@ -229,7 +230,11 @@ export default function UpdateComment({
229230
<Button
230231
variant="ghost"
231232
leadingIcon={Chats}
232-
isDisabled={true}
233+
onClick={() => {
234+
const id = `new-comment-${comment.updateId}`
235+
document.getElementById(id).focus()
236+
scrollToContentWithId(id)
237+
}}
233238
>
234239
Reply
235240
</Button>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy