diff --git a/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx b/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx index f2cfa6281..96195e51a 100644 --- a/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx +++ b/client/src/components/Tours/paddle/ObstacleDecisionPanel.tsx @@ -18,7 +18,7 @@ import { Unlink, X, } from 'lucide-react'; -import { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'; +import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'; import { useTranslation } from '../../../i18n'; import { fs } from '../../shared/DialogShell'; import { Tooltip } from '../../shared/Tooltip'; @@ -197,6 +197,11 @@ function NoteEditor({ onCancel: () => void; }) { const { t } = useTranslation(); + const box = useRef(null); + // The note opens for writing, so it takes the focus once, when it opens. + useEffect(() => { + box.current?.focus(); + }, []); const onKeyDown = (event: KeyboardEvent) => { if (event.key !== 'Escape') return; // The map card and the dialog close on Escape; inside the note it only ends the edit. @@ -209,8 +214,8 @@ function NoteEditor({