️(frontend) restore focus on docIcon after picker

Use focus store to return focus after emoji picker close.
This commit is contained in:
Cyril 2026-03-06 09:14:08 +01:00
parent 4c0c1f423e
commit 09fb9671e4
No known key found for this signature in database
GPG key ID: D5E8474B0AB0064A
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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<HTMLDivElement>(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 (