focus the textarea when the popup is visible
This commit is contained in:
parent
3fbb8f074a
commit
423c74bdc9
@ -98,11 +98,16 @@ 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
|
||||||
|
// because the textarea is not rendered yet)
|
||||||
|
useEffect(() => {
|
||||||
|
if (popupVisible) {
|
||||||
|
textareaRef.current?.focus();
|
||||||
|
}
|
||||||
|
}, [popupVisible]);
|
||||||
|
|
||||||
if (!popupVisible) return;
|
if (!popupVisible) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user