Skip to content

Commit d12bc1e

Browse files
Copilotalexr00
andcommitted
Extract magic number to named constant
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent a54c185 commit d12bc1e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

webviews/editorWebview/app.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)