Skip to content

fix(canvas/a11y+tests): aria-hidden backdrop, verifiedCPSession guard, useCanvasStore mock normalization - #1961

Merged
HongmingWang-Rabbit merged 5 commits into
stagingfrom
feat/canvas-activitytab-missingkeys-tests
Apr 24, 2026
Merged

fix(canvas/a11y+tests): aria-hidden backdrop, verifiedCPSession guard, useCanvasStore mock normalization#1961
HongmingWang-Rabbit merged 5 commits into
stagingfrom
feat/canvas-activitytab-missingkeys-tests

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore aria-hidden on canvas backdrop div after cherry-pick conflict resolution
  • Rename internal middleware fn to verifiedCPSession, keep backward-compatible public alias
  • Normalize useCanvasStore mock pattern across canvas test files (fixes GH#1740 keyboard context menu test)
  • Fix Go scoping: presented var must live in function scope, not block scope

Changes

  • canvas/src/components/Canvas/useWindowEvents.ts — aria-hidden on backdrop
  • workspace-server/handlers/middleware.go — verifiedCPSession rename + alias
  • canvas/src/__tests__/ — useCanvasStore mock normalization
  • workspace-server/handlers/ — Go scoping fix for presented variable

Test plan

  • pnpm test in canvas (useCanvasStore mock normalization)
  • go test ./handlers/... in workspace-server (verifiedCPSession)
  • Manual: canvas backdrop should have aria-hidden="true"
  • Manual: Approve/Deny buttons should be <button type="button">

🤖 Generated with Claude Code

@molecule-ai
molecule-ai Bot force-pushed the feat/canvas-activitytab-missingkeys-tests branch from 6d28ebd to 45bc8a9 Compare April 24, 2026 03:02
Molecule AI Core-QA and others added 4 commits April 24, 2026 03:10
…ck conflict

Cherry-pick from #1744 left the backdrop div without aria-hidden="true"
(the outer dialog div got it instead). Re-apply aria-hidden="true" to
the backdrop div so screen readers skip the clickable overlay layer.

Also revert test assertion from bg-black → bg-black/70 to match the
exact class applied to the backdrop div.
Standardize the mock for useCanvasStore to always expose getState()
(used by production ContextMenu to filter parent nodes). Applies the
same Object.assign-wrapping pattern introduced in #1744 to:
- ClaudeSettings.test.tsx
- tabs.a11y.test.tsx
- ContextMenu.keyboard.test.tsx (mockStore shape alignment)
… alias

The PR #1855 branch contains a newer version of session_auth.go that
renamed verifiedCPSession → VerifiedCPSession (exported) but also left
the already-exported definition in place, causing a duplicate declaration
compile error (line 174 and line 238 both declare VerifiedCPSession).

Fix: restore the internal func as verifiedCPSession (unexported) and keep
the public alias wrapper VerifiedCPSession at line 238 which delegates to
it — preserving the exported API that discovery.go and wsauth_middleware.go
depend on.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The short-var declaration inside the if-initializer scoped `presented`
only to that if statement, making it undefined on the following
`if presented { ... }` block. Move it to a plain assignment so it
remains accessible in the enclosing function scope.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai
molecule-ai Bot force-pushed the feat/canvas-activitytab-missingkeys-tests branch from 45bc8a9 to 8fb5ec0 Compare April 24, 2026 03:10
AllKeysModal already handles focus via autoFocus={index === 0} on the
first input and a separate title-focus effect. The orphaned useEffect
referencing firstInputRef (declared only in ProviderPickerModal) caused
a TypeScript build error: "Cannot find name 'firstInputRef'".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai

molecule-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

CI fix applied — Canvas (Next.js) build was failing with:

Type error: Cannot find name 'firstInputRef'. (MissingKeysModal.tsx:407)

Root cause: a stale useEffect inside AllKeysModal was referencing firstInputRef, which is only declared in the sibling ProviderPickerModal component. AllKeysModal already handles first-input focus via autoFocus={index === 0} and a title-focus effect — the orphaned hook was duplicate dead code.

Fix: removed the stale 5-line useEffect block. Pushed as 3715c06e. CI re-running.

@HongmingWang-Rabbit
HongmingWang-Rabbit merged commit 06a249b into staging Apr 24, 2026
14 checks passed
@molecule-ai
molecule-ai Bot deleted the feat/canvas-activitytab-missingkeys-tests branch May 20, 2026 06:21
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…ommunicate (#1955)' (#1961) from fix/registry-root-sibling-leak-1955 into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant