Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): rp-026 announce the drop verdict to assistive technology
M2c043618f28d
diff --git a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsxindex 2417cd07a..a7a9be89b 100644--- a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx+++ b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx@@ -1442,6 +1442,50 @@ describe('FileExplorerTree — drag-and-drop moves', () => {expect(bRow.getAttribute('data-drop-state')).toBe('checking')})+ it('announces the drop verdict to assistive technology (RP-026)', async () => {+ // The verdict is painted on the target row (a tint and a data attribute),+ // which a screen reader never announces. The live region states it.+ const affordances = vi.fn(async (resourceId: string) => {+ if (resourceId === 'folderb') return { held: ['read', 'write'] }+ return { held: ['read', 'write', 'delete'] }+ })+ const resolve = vi.fn(async (uri: string) => {+ const id = uri.split('/').pop()+ return {+ drive: 'main',+ resourceId: id === 'grand' ? 'grand' : id,+ parentResourceId: id === 'grand' ? null : 'grand',+ name: id === 'foldera' ? 'A' : id === 'folderb' ? 'B' : 'Grand',+ kind: 'directory',+ version: id === 'foldera' ? 4 : 1,+ }+ })+ installDndClerum({+ listAccessible: vi.fn(async () =>+ listAccessiblePage([+ accessibleResource('foldera', 'A', 'directory', { version: 4 }),+ accessibleResource('folderb', 'B', 'directory'),+ ])+ ),+ affordances,+ resolve,+ moveResource: vi.fn(async () => ({ resourceId: 'foldera', version: 9 })),+ })+ renderTreeWithSession()++ const rowA = await screen.findByRole('button', { name: 'A' })+ const rowB = await screen.findByRole('button', { name: 'B' })+ const dataTransfer = dragTypes()+ const bRow = rowB.closest('[role="treeitem"]')!.querySelector('.da-file-explorer__row')!++ fireEvent.dragStart(rowA, { dataTransfer })+ fireEvent.dragOver(bRow, { dataTransfer })++ // The verdict is spoken, not only painted — synchronously with the hover,+ // before any probe resolves.+ expect(screen.getByText(/Checking whether you can move into B/)).toBeTruthy()+ })+it('cancels the hover-expand timer when the drop lands on the row (RP-024)', async () => {// The browser does not necessarily fire a dragleave after a drop, so the// row's own hover-expand timer survived the drop: the folder expandeddiff --git a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsxindex 432cfa666..e3615b9c8 100644--- a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx+++ b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx@@ -21,6 +21,7 @@ import { useGfsDragAdjudication } from '@/gfs/dragAdjudication'import { ownsGfsDrop } from '@/gfs/dragOwnership'import type { GfsDragSource } from '@/gfs/dragSession'import { useGfsDragSession } from '@/gfs/dragSession'+import { gfsDropVerdictAnnouncement } from '@/gfs/dropVerdict'import { moveDenialMessage, suggestNumberedMoveName } from '@/gfs/moveCommit'import { runGfsMoveCommit } from '@/gfs/moveCommitRunner'import { GfsMoveConfirmDialog } from '@/gfs/moveConfirmDialog'@@ -451,6 +452,10 @@ export function FileExplorerTree({const [dropStatesByResourceId, setDropStatesByResourceId] = useState<Record<string, FileExplorerDropState>>({})+ // The drop verdict is painted on the target row, which assistive technology+ // never announces. The spoken form lives here so the verdict reaches a+ // screen reader as well (RP-026).+ const [dropVerdictAnnouncement, setDropVerdictAnnouncement] = useState('')const [movingResourceId, setMovingResourceId] = useState<string | null>(null)const movingResourceIdRef = useRef<string | null>(null)const draggingSourceRef = useRef<GfsDragSource | null>(null)@@ -549,6 +554,7 @@ export function FileExplorerTree({dragSession?.endDrag()adjudication.endDragSession()setDropStatesByResourceId({})+ setDropVerdictAnnouncement('')}, [adjudication, dragSession])/** Release only the source and hover work owned by the admitted gesture. */@@ -660,6 +666,7 @@ export function FileExplorerTree({? previous: { ...previous, [node.resourceId]: verdict.state })+ setDropVerdictAnnouncement(gfsDropVerdictAnnouncement(verdict.state, node.name))// 'checking' must keep the drop LANDABLE (rev-2 §4.1): dropEffect 'none'// makes Chromium cancel the drag at release, so the drop-time priority// adjudication could never run and unresolved authority checks silently@@ -682,6 +689,7 @@ export function FileExplorerTree({? previous: { ...previous, [node.resourceId]: fresh.state })+ setDropVerdictAnnouncement(gfsDropVerdictAnnouncement(fresh.state, node.name))})}@@ -700,6 +708,7 @@ export function FileExplorerTree({delete next[node.resourceId]return next})+ setDropVerdictAnnouncement('')},[])@@ -748,6 +757,7 @@ export function FileExplorerTree({event.preventDefault()event.stopPropagation()setDropStatesByResourceId({})+ setDropVerdictAnnouncement('')const source = resolveActiveSource()if (!source || node.kind !== 'directory' || movingResourceIdRef.current) returnconst epoch = dragSessionEpochRef.current@@ -873,6 +883,12 @@ export function FileExplorerTree({return (<div className="da-file-explorer">+ {/* The drop verdict is painted on the target row; this live region is+ its spoken form, so a screen reader learns whether the folder under+ the pointer accepts the move (RP-026). */}+ <p aria-live="polite" className="visually-hidden">+ {dropVerdictAnnouncement}+ </p>{ctrl.accessState === 'revoked' ? (// Mirror the Files page's revoked surface, adapted to the sidebar's// compact chrome. Without this branch a revoked drive falls through todiff --git a/desktop-app/ui/src/gfs/dropVerdict.ts b/desktop-app/ui/src/gfs/dropVerdict.tsnew file mode 100644index 000000000..2e54ecd8e--- /dev/null+++ b/desktop-app/ui/src/gfs/dropVerdict.ts@@ -0,0 +1,29 @@+import type { GfsDropVerdict } from './dragSession.types'++/**+ * The spoken form of a drop verdict (RP-026).+ *+ * The verdict itself is painted on the target row — a border tint and a+ * `data-drop-state` attribute — which a screen reader never announces. The+ * user dragging with a keyboard or a screen reader therefore gets no feedback+ * at all about whether the folder under the pointer accepts the move.+ *+ * One wording for every surface, so the sidebar and the Files page announce+ * the same thing for the same verdict.+ */+export function gfsDropVerdictAnnouncement(+ state: GfsDropVerdict['state'],+ targetName: string+): string {+ const target = targetName.trim() || 'this folder'+ switch (state) {+ case 'allowed':+ return `You can move into ${target}.`+ case 'denied':+ return `You cannot move into ${target}.`+ case 'unavailable':+ return `EvenDrive could not confirm whether you can move into ${target}.`+ default:+ return `Checking whether you can move into ${target}…`+ }+}diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsxindex d5426e97d..c4e70f871 100644--- a/desktop-app/ui/src/pages/FilesPage.tsx+++ b/desktop-app/ui/src/pages/FilesPage.tsx@@ -68,6 +68,7 @@ import { useGfsDragAdjudication } from '@/gfs/dragAdjudication'import { ownsGfsDrop } from '@/gfs/dragOwnership'import type { GfsDragSource, GfsDropVerdict } from '@/gfs/dragSession'import { useGfsDragSession } from '@/gfs/dragSession'+import { gfsDropVerdictAnnouncement } from '@/gfs/dropVerdict'import { GfsFilePicker } from '@/gfs/filePicker'import { moveDenialMessage, suggestNumberedMoveName } from '@/gfs/moveCommit'import type { MoveCommitOutcome } from '@/gfs/moveCommit'@@ -344,6 +345,10 @@ export function FilesPage({const [dragOverFolderId, setDragOverFolderId] = useState<string | null>(null)const [movingResourceId, setMovingResourceId] = useState<string | null>(null)const [dropStatesById, setDropStatesById] = useState<Record<string, GfsDropVerdict['state']>>({})+ // The drop verdict is painted on the target row; this live region is its+ // spoken form, so a screen reader learns whether the folder under the+ // pointer accepts the move (RP-026).+ const [dropVerdictAnnouncement, setDropVerdictAnnouncement] = useState('')// Folder drops stop at ONE confirmation (impact + naming policy) before the// shared dispatch; files commit directly on an allowed admission.const [pendingFolderMove, setPendingFolderMove] = useState<{@@ -428,6 +433,7 @@ export function FilesPage({setDraggingResourceId(null)setDragOverFolderId(null)setDropStatesById({})+ setDropVerdictAnnouncement('')}, [adjudication.endDragSession, liveDragScope])const ownsDrop = (source: GfsDragSource, epoch: number, sharedGeneration: number | null) =>@@ -1265,7 +1271,11 @@ export function FilesPage({: null}- const applyHoverVerdict = (folderId: string, verdict: GfsDropVerdict): GfsDropVerdict => {+ const applyHoverVerdict = (+ folderId: string,+ verdict: GfsDropVerdict,+ folderName = ''+ ): GfsDropVerdict => {if (verdict.state === 'allowed') {setDragOverFolderId(folderId)} else if (hoveredFolderRef.current === folderId) {@@ -1274,6 +1284,7 @@ export function FilesPage({setDropStatesById(previous =>previous[folderId] === verdict.state ? previous : { ...previous, [folderId]: verdict.state })+ setDropVerdictAnnouncement(gfsDropVerdictAnnouncement(verdict.state, folderName))return verdict}@@ -1327,7 +1338,11 @@ export function FilesPage({kind: folder.kind,ancestorIds: rowTargetAncestorIds(),} as const- const verdict = applyHoverVerdict(folder.resourceId, adjudication.hoverVerdict(source, target))+ const verdict = applyHoverVerdict(+ folder.resourceId,+ adjudication.hoverVerdict(source, target),+ folder.name+ )// 'checking' must keep the drop LANDABLE: with dropEffect 'none' Chromium// cancels the drag at release, so the drop-time priority adjudication// (rev-2 §4.1 — "priority check on drop instead of a false deny") could@@ -1342,7 +1357,7 @@ export function FilesPage({if (hoverOwnerRef.current !== source || hoveredFolderRef.current !== folder.resourceId)returnconst fresh = adjudication.hoverVerdict(source, target)- applyHoverVerdict(folder.resourceId, fresh)+ applyHoverVerdict(folder.resourceId, fresh, folder.name)})}@@ -1355,6 +1370,7 @@ export function FilesPage({if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {hoveredFolderRef.current = nullsetDragOverFolderId(null)+ setDropVerdictAnnouncement('')}}@@ -1414,6 +1430,7 @@ export function FilesPage({hoveredFolderRef.current = nullsetDragOverFolderId(null)setDropStatesById({})+ setDropVerdictAnnouncement('')const source = resolveActiveSource()if (!source || destination.kind !== 'directory' || movingResourceRef.current) return@@ -1838,6 +1855,12 @@ export function FilesPage({return (<section className="page da-gfs-page">+ {/* The drop verdict is painted on the target row; this live region is+ its spoken form, so a screen reader learns whether the folder under+ the pointer accepts the move (RP-026). */}+ <p aria-live="polite" className="visually-hidden">+ {dropVerdictAnnouncement}+ </p><div className="page-header"><h2>Files</h2><p className="muted">Browse and manage everything shared with you in one place.</p>