Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve calendar drawer focus and wait for linked events (#7126)
[._.]/ Adam Eivyf1553d03d8ad
diff --git a/client/src/components/calendar/MonthView.jsx b/client/src/components/calendar/MonthView.jsxindex f00e5711ff..2e1761643b 100644--- a/client/src/components/calendar/MonthView.jsx+++ b/client/src/components/calendar/MonthView.jsx@@ -1,4 +1,4 @@-import { useState, useEffect, useMemo } from 'react';+import { useState, useEffect, useMemo, useRef } from 'react';import {ChevronLeft, ChevronRight} from 'lucide-react';import * as api from '../../services/api';import socket from '../../services/socket';@@ -100,10 +100,20 @@ export default function MonthView({ accounts }) {const selectedEventKey = searchParams.get('event');const selectedEvent = events.find((event) => `${event.accountId}:${event.id}` === selectedEventKey) || null;const todayStr = now.toDateString();+ const dayTriggerRef = useRef(null);// Matching against the visible grid rejects impossible and stale day keys.const selectedDay = cells.find(cell => localDateKey(cell.date) === searchParams.get('day'));const selectedDayEvents = [...(eventsByDay[selectedDay?.date.toDateString()] || [])].sort((a, b) => Number(b.isAllDay) - Number(a.isAllDay) || new Date(a.startTime) - new Date(b.startTime));+ // Event details temporarily replace the day drawer, so preserve the original+ // month trigger across that intermediate drawer's focus-restoration cycle.+ useEffect(() => {+ if (!selectedDay && !selectedEvent && dayTriggerRef.current) {+ dayTriggerRef.current.focus();+ dayTriggerRef.current = null;+ }+ }, [selectedDay, selectedEvent]);+const openEvent = (event) => updateParams({ month: monthKey, event: `${event.accountId}:${event.id}` });return (@@ -182,7 +192,10 @@ export default function MonthView({ accounts }) {<buttontype="button"aria-label={`View all ${dayEvents.length} events for ${formatDateFull(cell.date)}`}- onClick={() => updateParams({ month: monthKey, day: localDateKey(cell.date), event: null })}+ onClick={(e) => {+ dayTriggerRef.current = e.currentTarget;+ updateParams({ month: monthKey, day: localDateKey(cell.date), event: null });+ }}className="w-full text-left text-[10px] text-port-accent pl-1 py-1 rounded hover:bg-port-border focus-visible:outline focus-visible:outline-port-accent">+{dayEvents.length - 3} more@@ -197,7 +210,7 @@ export default function MonthView({ accounts }) {)}<Drawer- open={!!selectedDay && !selectedEvent}+ open={!!selectedDay && !selectedEvent && !loading}onClose={() => updateParams({ day: null, event: null })}title={selectedDay ? formatDateFull(selectedDay.date) : ''}subtitle={`${selectedDayEvents.length} events`}diff --git a/client/src/components/calendar/calendarEventChips.test.jsx b/client/src/components/calendar/calendarEventChips.test.jsxindex 8fd70b7712..35dd0a8786 100644--- a/client/src/components/calendar/calendarEventChips.test.jsx+++ b/client/src/components/calendar/calendarEventChips.test.jsx@@ -313,6 +313,29 @@ describe('MonthView overflow navigation', () => {expect(screen.getByRole('heading', { name: 'January 2027' })).toBeInTheDocument();});+ it('restores keyboard focus to overflow after the nested detail journey', async () => {+ render(<MemoryRouter initialEntries={['/calendar/month?month=2027-01']}><MonthView accounts={ACCOUNTS} /></MemoryRouter>);+ await act(async () => {});+ const trigger = screen.getByRole('button', { name: /View all 4 events/ });+ trigger.focus();+ fireEvent.click(trigger);+ fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: /Example hidden appointment/ }));+ fireEvent.click(screen.getByRole('button', { name: 'Close', exact: true }));+ fireEvent.click(screen.getByRole('button', { name: 'Close day events' }));+ expect(trigger).toHaveFocus();+ });++ it('waits for bookmarked event data before exposing a dismissible drawer', async () => {+ let finish;+ api.getCalendarEvents.mockReturnValue(new Promise(resolve => { finish = resolve; }));+ render(<MemoryRouter initialEntries={['/calendar/month?month=2027-01&day=2027-01-12&event=acct-1:hidden']}><MonthView accounts={ACCOUNTS} /></MemoryRouter>);+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();+ await act(async () => finish({ events: [{ ...TIMED, id: 'hidden', title: 'Example hidden appointment', startTime: new Date(2027, 0, 12, 12).toISOString() }] }));+ expect(screen.getByRole('dialog', { name: 'Example hidden appointment' })).toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', { name: 'Close', exact: true }));+ expect(screen.getByRole('button', { name: 'Close day events' })).toBeInTheDocument();+ });+it.each(['2027-02-30', '2020-01-01', 'garbage'])('ignores malformed or off-grid day %s', async day => {render(<MemoryRouter initialEntries={['/calendar/month?month=2027-01&day=' + day]}><MonthView accounts={ACCOUNTS} /></MemoryRouter>);await act(async () => {});