From 694b19dc5ff5a112fd106a2a384ae56fb5b7e70d Mon Sep 17 00:00:00 2001 From: "Bingxi Zhao (Frank)" <13051345080@163.com> Date: Wed, 2 Dec 2026 05:59:44 -0500 Subject: [PATCH] fix(notes): focus the first action when the on-demand menu mounts --- web/features/notes/components/NotePageMenu.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 ? ( <>