Skip to content

Fix table unmapped click selection#4967

Closed
zbeyens wants to merge 2 commits intomainfrom
codex/4956-table-unmapped-dom-selection
Closed

Fix table unmapped click selection#4967
zbeyens wants to merge 2 commits intomainfrom
codex/4956-table-unmapped-dom-selection

Conversation

@zbeyens
Copy link
Copy Markdown
Member

@zbeyens zbeyens commented Apr 25, 2026

  • Auto release

Fixes #4956

What

  • Add a table mousedown guard for unmapped editor-root clicks.
  • Treat data-slate-node=\"value\" as the editor root, not a mapped Slate descendant.
  • Select the nearest valid Slate point before native typing or paste can edit outside the value.
  • Add regression coverage, a changeset, and a solution note for the false normalization path.
  • Include the current checkout's apps/www/next-env.d.ts route-type path change.

Verification

  • RED: bun test packages/table/src/react/onMouseDownTable.spec.tsx failed before the root guard handled data-slate-node=\"value\".
  • pnpm install
  • pnpm turbo build --filter=./packages/table
  • pnpm turbo typecheck --filter=./packages/table
  • bun test packages/table/src
  • pnpm lint:fix
  • pnpm check
  • Browser: /docs/table, root click target was data-slate-node=\"value\", selection moved to Slate text, typed text stayed in the table, and no console/page errors fired.

Browser Proof

Screenshot captured locally at /Users/zbeyens/.dev-browser/tmp/plate-4956-table-unmapped-click-fixed.png.

@zbeyens zbeyens requested a review from a team April 25, 2026 22:05
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Apr 25, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 25, 2026

🦋 Changeset detected

Latest commit: bc1f0e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@platejs/table Patch
@platejs/ai Patch
@platejs/csv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 25, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

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

Project Deployment Actions Updated (UTC)
plate Ready Ready Preview, Comment Apr 25, 2026 10:44pm

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7403c750ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/www/next-env.d.ts
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep next-env route import stable across dev/build modes

This import was changed to ./.next/dev/types/routes.d.ts, which is a dev-mode output path. In build/typegen flows Next writes route types under ./.next/types/routes.d.ts, so this committed value becomes mode-dependent and gets rewritten in non-dev workflows, creating deterministic churn and potentially pointing at a missing route-types file when only build artifacts are present.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working patch Bugfix & documentation PR plugin:table Tables size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Table: clicks on unmapped DOM regions desync selection and crash toSlateRange on typing/paste

1 participant