From 09fb9671e4f7052a882082e94417b14c379687d5 Mon Sep 17 00:00:00 2001 From: Cyril Date: Fri, 6 Mar 2026 09:14:08 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BF=EF=B8=8F(frontend)=20restore=20focus?= =?UTF-8?q?=20on=20docIcon=20after=20picker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use focus store to return focus after emoji picker close. --- CHANGELOG.md | 1 + .../features/docs/doc-management/components/DocIcon.tsx | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f811c24..65c0407e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to ### Changed - 📝(docs) improve README and add documentation hub #1870 +- ♿️(frontend) restore focus to triggers after closing menus and modals #1863 ## [v4.6.0] - 2026-03-03 diff --git a/src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx b/src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx index c5518c1d..6b8d0fc3 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx @@ -13,6 +13,7 @@ import { TextType, emojidata, } from '@/components'; +import { useFocusStore } from '@/stores'; import { useDocTitleUpdate } from '../hooks/useDocTitleUpdate'; @@ -41,6 +42,7 @@ export const DocIcon = ({ }: DocIconProps) => { const { updateDocEmoji } = useDocTitleUpdate(); const { t } = useTranslation(); + const { addLastFocus, restoreFocus } = useFocusStore(); const iconRef = useRef(null); @@ -90,12 +92,16 @@ export const DocIcon = ({ }); } + if (!openEmojiPicker) { + addLastFocus(iconRef.current); + } setOpenEmojiPicker(!openEmojiPicker); } }; const handleEmojiSelect = ({ native }: { native: string }) => { setOpenEmojiPicker(false); + restoreFocus(); // Update document emoji if docId is provided if (docId && title !== undefined) { @@ -108,6 +114,7 @@ export const DocIcon = ({ const handleClickOutside = () => { setOpenEmojiPicker(false); + restoreFocus(); }; return (