Skip to content

Commit

Permalink
[Upd #79] Click on comment icon assigns focus to comment dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Dec 7, 2021
1 parent a427570 commit 3f4251c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/comment/CommentForm.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React, {useState} from "react";
import React, {useEffect, useRef, useState} from "react";
import {Button, Form, Col, Row} from "react-bootstrap";
import PropTypes from "prop-types";
import ArrowRight from "../../styles/icons/ArrowRight";

const CommentForm = (props) => {
const [commentValue, setCommentValue] = useState('');
const formInputRef = useRef(null);

useEffect(() => {
formInputRef.current.focus();
}, []);

const onValueChange = (e) => {
setCommentValue(e.target.value);
Expand Down Expand Up @@ -36,6 +41,7 @@ const CommentForm = (props) => {
required
value={commentValue}
onChange={onValueChange}
ref={formInputRef}
/>
</Row>
<Row className="send-comment-arrow col-lg-12">
Expand Down

0 comments on commit 3f4251c

Please sign in to comment.