Skip to content

refactor: guard text selection event target - #2162

Open
uno-prod-internal-app[bot] wants to merge 1 commit into
mainfrom
uno/guard-text-selection-event-target-78
Open

uno-prod-internal-app[bot] wants to merge 1 commit into
mainfrom
uno/guard-text-selection-event-target-78

Conversation

@uno-prod-internal-app

Copy link
Copy Markdown
Contributor

Summary

  • replace the MouseEvent.target type assertion in useTextSelection with an instanceof Node runtime guard
  • treat null or non-Node event targets as outside the scoped element
  • keep the change isolated to the outside-click selection reset

Validation

  • pnpm --filter rooks exec vitest run src/__tests__/useTextSelection.spec.tsx (23 passed)
  • pnpm --filter rooks test (2,303 passed, 21 skipped)
  • pnpm --filter rooks exec tsc --noEmit -p tsconfig.json
  • pnpm --filter rooks exec eslint src/hooks/useTextSelection.ts (0 errors; 1 pre-existing ref-access warning)
  • pnpm --filter rooks exec prettier --check src/hooks/useTextSelection.ts
  • git diff --check main..HEAD

@codesandbox

codesandbox Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rooks Ready Ready Preview Aug 22, 2026 12:14am

@mergify

mergify Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

0 participants