Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(canvas): isolate react flow accessibility ids

Rahmanfb40e1b41341
diff --git a/components/shared/graph-canvas.tsx b/components/shared/graph-canvas.tsx
index e75c6dbe..3ba86b87 100644
--- a/components/shared/graph-canvas.tsx
+++ b/components/shared/graph-canvas.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useEffect, useId, useState } from "react";
import {
Background,
BackgroundVariant,
@@ -48,6 +48,8 @@ function GraphCanvasInner<NodeType extends Node = Node, EdgeType extends Edge =
className, children, fitViewOptions, onKeyDown, ...props
}: GraphCanvasProps<NodeType, EdgeType>) {
const [mode, setMode] = useState<GraphCanvasMode>(initialMode);
+ const instanceId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
+ const flowId = props.id || `mso-graph-${instanceId}`;
const [containerRef, pane] = useContainer<HTMLDivElement>();
const compact = pane === "xs" || pane === "sm";
const { fitView, zoomIn, zoomOut } = useReactFlow<NodeType, EdgeType>();
@@ -75,6 +77,7 @@ function GraphCanvasInner<NodeType extends Node = Node, EdgeType extends Edge =
return <div ref={containerRef} className="h-full min-h-0 w-full min-w-0 outline-none" tabIndex={0} onKeyDown={keyboard}>
<ReactFlow<NodeType, EdgeType>
{...props}
+ id={flowId}
aria-label={ariaLabel}
className={cn("mso-graph-flow h-full w-full", className)}
fitView fitViewOptions={{ padding: fitPadding, duration: 220, ...fitViewOptions }}