diff --git a/web/features/notes/components/NotePageMenu.tsx b/web/features/notes/components/NotePageMenu.tsx index 14916428b..ae7850d89 100644 --- a/web/features/notes/components/NotePageMenu.tsx +++ b/web/features/notes/components/NotePageMenu.tsx @@ -1,6 +1,6 @@ 'use client' -import { useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { ArrowLeft, Bookmark, Check, ChevronRight, CornerUpRight, FileDown, FileText, Pin, PinOff } from 'lucide-react' import type { NotePage, NoteSummary } from '@/lib/notes-api' @@ -21,6 +21,11 @@ export default function NotePageMenu({ const { t } = useTranslation() const [moving, setMoving] = useState(false) const [query, setQuery] = useState('') + const menuRef = useRef(null) + useEffect(() => { + // The parent can open before this on-demand chunk has mounted. + menuRef.current?.querySelector('[role="menuitem"]:not(:disabled)')?.focus() + }, []) const targets = pages .filter(p => p.id !== page?.id && !invalidParents.has(p.id)) .filter(p => (p.title || '').toLowerCase().includes(query.trim().toLowerCase())) @@ -29,7 +34,7 @@ export default function NotePageMenu({ onMetadata({ parent_id }) } return ( -
+
{moving ? ( <>