Skip to content

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

fix: add focus trap, Escape dismiss, and dialog semantics to fullscreen process logs (#8735)

[._.]/ Adam Eivy902e2f169e35
diff --git a/client/src/components/apps/tabs/ProcessesTab.jsx b/client/src/components/apps/tabs/ProcessesTab.jsx
index d410f6ab5b..8cfc66478e 100644
--- a/client/src/components/apps/tabs/ProcessesTab.jsx
+++ b/client/src/components/apps/tabs/ProcessesTab.jsx
@@ -7,6 +7,7 @@ import { FormField } from '../../ui/FormField';
import ProcessLogLines from '../../ui/ProcessLogLines';
import { useProcessSnapshot } from '../../../hooks/useProcessSnapshot';
import { useProcessLogs } from '../../../hooks/useProcessLogs';
+import useFocusTrap from '../../../hooks/useFocusTrap';
import { copyToClipboard } from '../../../lib/clipboard';
import { formatBytes, formatCount, formatDurationMs, formatTimeOfDaySeconds } from '../../../utils/formatters';
@@ -26,6 +27,11 @@ export default function ProcessesTab({ appId, pm2ProcessNames, filterFn }) {
const [fullscreen, setFullscreen] = useState(false);
const logsRef = useRef(null);
const fullscreenLogsRef = useRef(null);
+ const fullscreenModalRef = useRef(null);
+ const fullscreenButtonRef = useRef(null);
+
+ // Focus trap for fullscreen modal: trap Tab/Shift+Tab and restore focus on close
+ useFocusTrap(fullscreen, fullscreenModalRef);
// Socket log lifecycle lives in the shared hook so this tab and the desktop
// launch-progress panel can't drift.
@@ -63,6 +69,13 @@ export default function ProcessesTab({ appId, pm2ProcessNames, filterFn }) {
copyToClipboard(text, 'Logs copied');
};
+ const handleFullscreenEscape = (e) => {
+ if (e.key === 'Escape' && fullscreen) {
+ e.preventDefault();
+ setFullscreen(false);
+ }
+ };
+
const filteredProcesses = filterFn
? processes.filter(proc => filterFn(proc.name))
: pm2ProcessNames
@@ -205,6 +218,7 @@ export default function ProcessesTab({ appId, pm2ProcessNames, filterFn }) {
Copy logs
</button>
<button
+ ref={fullscreenButtonRef}
onClick={() => setFullscreen(true)}
className="min-h-[44px] px-1 text-xs text-gray-500 hover:text-white flex items-center gap-1"
title="Fullscreen"
@@ -251,7 +265,14 @@ export default function ProcessesTab({ appId, pm2ProcessNames, filterFn }) {
directly because this overlay isn't a <Modal>.
*/}
{fullscreen && expandedProcess && createPortal(
- <div className="fixed inset-0 bg-port-bg z-50 flex flex-col">
+ <div
+ ref={fullscreenModalRef}
+ className="fixed inset-0 bg-port-bg z-50 flex flex-col"
+ role="dialog"
+ aria-modal="true"
+ aria-label={`Logs for ${expandedProcess}`}
+ onKeyDown={handleFullscreenEscape}
+ >
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 px-4 sm:px-6 py-3 sm:py-4 border-b border-port-border bg-port-card">
<div className="flex flex-wrap items-center gap-2 sm:gap-4">
<span className="text-lg font-medium text-white">Logs: {expandedProcess}</span>
diff --git a/client/src/components/apps/tabs/ProcessesTab.test.jsx b/client/src/components/apps/tabs/ProcessesTab.test.jsx
index 4620108bac..040a5c49ff 100644
--- a/client/src/components/apps/tabs/ProcessesTab.test.jsx
+++ b/client/src/components/apps/tabs/ProcessesTab.test.jsx
@@ -108,4 +108,49 @@ describe('ProcessesTab', () => {
fireEvent.click(screen.getByRole('button', { name: 'Exit fullscreen' }));
expect(document.body.querySelector('.fixed.inset-0')).toBeNull();
});
+
+ it('fullscreen log viewer has dialog semantics and ARIA attributes', () => {
+ render(<ProcessesTab appId="app-1" pm2ProcessNames={['example-api']} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Expand details for example-api' }));
+ fireEvent.click(screen.getByTitle('Fullscreen'));
+
+ const dialog = screen.getByRole('dialog', { name: 'Logs for example-api' });
+ expect(dialog).toBeTruthy();
+ expect(dialog).toHaveAttribute('aria-modal', 'true');
+ expect(dialog).toHaveAttribute('aria-label', 'Logs for example-api');
+ });
+
+ it('pressing Escape closes the fullscreen log viewer', () => {
+ render(<ProcessesTab appId="app-1" pm2ProcessNames={['example-api']} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Expand details for example-api' }));
+ fireEvent.click(screen.getByTitle('Fullscreen'));
+
+ expect(screen.getByRole('dialog', { name: 'Logs for example-api' })).toBeTruthy();
+
+ // Press Escape to close fullscreen
+ fireEvent.keyDown(screen.getByRole('dialog', { name: 'Logs for example-api' }), { key: 'Escape' });
+
+ // Dialog should be gone
+ expect(screen.queryByRole('dialog', { name: 'Logs for example-api' })).toBeNull();
+ });
+
+ it('fullscreen log viewer traps focus within the modal', () => {
+ useProcessLogs.mockReturnValue({
+ logs: [{ line: 'test', type: 'stdout', timestamp: 100 }],
+ subscribed: false,
+ clear: vi.fn(),
+ });
+ render(<ProcessesTab appId="app-1" pm2ProcessNames={['example-api']} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Expand details for example-api' }));
+ fireEvent.click(screen.getByTitle('Fullscreen'));
+
+ const dialog = screen.getByRole('dialog', { name: 'Logs for example-api' });
+ const exitButton = screen.getByRole('button', { name: 'Exit fullscreen' });
+
+ // Focus should be inside the modal (on the exit button or another control)
+ expect(dialog.contains(document.activeElement)).toBe(true);
+ });
});