File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,15 @@ export function Root({ children }) {
2525 // Restore focus to comment textarea when window regains focus if user was typing
2626 useEffect ( ( ) => {
2727 const handleWindowFocus = ( ) => {
28- // Give the focus event time to settle
28+ // Delay to let the focus event settle before checking focus state
29+ const FOCUS_SETTLE_DELAY_MS = 100 ;
2930 setTimeout ( ( ) => {
3031 const commentTextarea = document . getElementById ( 'comment-textarea' ) as HTMLTextAreaElement ;
3132 // Only restore focus if there's content and nothing else has focus
3233 if ( commentTextarea && commentTextarea . value && document . activeElement === document . body ) {
3334 commentTextarea . focus ( ) ;
3435 }
35- } , 100 ) ;
36+ } , FOCUS_SETTLE_DELAY_MS ) ;
3637 } ;
3738
3839 window . addEventListener ( 'focus' , handleWindowFocus ) ;
You can’t perform that action at this time.
0 commit comments