fix: preserve mobile section focus

This commit is contained in:
ajnart committed 2026-07-28 19:39:13 +02:00
1 parent 6dbfbb1417
commit 7ce1081161
1 file changed
+5 -3
@@ -269,6 +269,7 @@ const MobileMoreMenu = ({ showSettings }: { showSettings: boolean }) => {
const tProfile = useScopedI18n("common.userAvatar.menu"); const tProfile = useScopedI18n("common.userAvatar.menu");
const reduceMotion = useReducedMotion(); const reduceMotion = useReducedMotion();
const [opened, disclosure] = useDisclosure(false); const [opened, disclosure] = useDisclosure(false);
const moreTriggerRef = useRef<HTMLButtonElement>(null);
const pendingSectionAnchorId = useRef<string | null>(null); const pendingSectionAnchorId = useRef<string | null>(null);
const desktopLayout = getDesktopLayout(board); const desktopLayout = getDesktopLayout(board);
const sections = useMemo( const sections = useMemo(
@@ -284,14 +285,14 @@ const MobileMoreMenu = ({ showSettings }: { showSettings: boolean }) => {
const focusPendingSection = () => { const focusPendingSection = () => {
const anchorId = pendingSectionAnchorId.current; const anchorId = pendingSectionAnchorId.current;
pendingSectionAnchorId.current = null; pendingSectionAnchorId.current = null;
if (!anchorId) return; if (anchorId && focusMobileBoardSection({ anchorId, reduceMotion })) return;
focusMobileBoardSection({ anchorId, reduceMotion }); moreTriggerRef.current?.focus({ preventScroll: true });
}; };
return ( return (
<> <>
<HeaderButton onClick={disclosure.open} aria-label={t("board.mobile.more")}> <HeaderButton ref={moreTriggerRef} onClick={disclosure.open} aria-label={t("board.mobile.more")}>
<IconDotsVertical stroke={1.5} /> <IconDotsVertical stroke={1.5} />
</HeaderButton> </HeaderButton>
<Drawer <Drawer
@@ -302,6 +303,7 @@ const MobileMoreMenu = ({ showSettings }: { showSettings: boolean }) => {
size="auto" size="auto"
padding="md" padding="md"
overlayProps={{ backgroundOpacity: 0.45, blur: 2 }} overlayProps={{ backgroundOpacity: 0.45, blur: 2 }}
returnFocus={false}
onExitTransitionEnd={focusPendingSection} onExitTransitionEnd={focusPendingSection}
styles={{ styles={{
content: { content: {