fix bug with focusing textarea
This commit is contained in:
parent
423c74bdc9
commit
5f3868f3c9
@ -98,10 +98,14 @@ const EditPopup: React.FC<EditPopupProps> = ({
|
|||||||
|
|
||||||
// Reset the update text
|
// Reset the update text
|
||||||
setUpdateText("");
|
setUpdateText("");
|
||||||
|
|
||||||
|
// Focus the textarea
|
||||||
|
textareaRef.current?.focus();
|
||||||
}, [event, iframeRef]);
|
}, [event, iframeRef]);
|
||||||
|
|
||||||
// Focus the textarea when the popup is visible (we can't do this when handling the click event
|
// Focus the textarea when the popup is visible (we can't do this only when handling the click event
|
||||||
// because the textarea is not rendered yet)
|
// because the textarea is not rendered yet)
|
||||||
|
// We need to also do it in the click event because popupVisible doesn't change values in that event
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (popupVisible) {
|
if (popupVisible) {
|
||||||
textareaRef.current?.focus();
|
textareaRef.current?.focus();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user