Skip to content

fix(table): avoid arrow caret flash#4923

Merged
zbeyens merged 2 commits intoudecode:mainfrom
hhhjin:codex/table-arrow-navigation-caret-flash
Mar 29, 2026
Merged

fix(table): avoid arrow caret flash#4923
zbeyens merged 2 commits intoudecode:mainfrom
hhhjin:codex/table-arrow-navigation-caret-flash

Conversation

@hhhjin
Copy link
Copy Markdown
Collaborator

@hhhjin hhhjin commented Mar 29, 2026

Summary

Plain ArrowUp / ArrowDown navigation in table cells could briefly flash the native caret before the selection moved to the adjacent cell.

Issue:

Screen.Recording.2026-03-29.at.21.00.54.mov

Previous flow:

  • overrideSelectionFromCell watched for the browser selection update
  • once the new selection left the current cell, it scheduled moveSelectionFromCell in a setTimeout
  • that corrected the final selection after native caret movement had already painted
  • result: the final selection was right, but an intermediate caret flash could still appear

Updated flow:

  • plain collapsed vertical table navigation is handled earlier in withTable.moveLine
  • when the caret is still able to move within the current cell, native vertical movement is preserved
  • once the caret reaches the visual first or last line, moveSelectionFromCell moves selection to the adjacent cell
  • result: table navigation is resolved before native caret motion can paint the intermediate flash

Behavior covered by the new path:

  • multi-block cells
  • soft-break cells
  • soft-wrapped single-block cells

What stays the same:

  • overrideSelectionFromCell still handles shift-based table selection expansion
  • moveSelectionFromCell remains the transform that performs the actual cross-cell move

Testing

  • pnpm install --ignore-scripts
  • pnpm turbo build --filter=./packages/table
  • pnpm turbo typecheck --filter=./packages/table
  • pnpm lint:fix
  • bun test packages/table/src/lib

Checklist

  • pnpm typecheck
  • pnpm lint:fix
  • bun test
  • pnpm brl
  • pnpm changeset
  • ui changelog

@hhhjin hhhjin requested a review from a team March 29, 2026 12:17
@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Mar 29, 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 Mar 29, 2026

🦋 Changeset detected

Latest commit: 42eeb13

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

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

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

Project Deployment Actions Updated (UTC)
plate Ready Ready Preview, Comment Mar 29, 2026 11:30pm

Request Review

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Mar 29, 2026
@dosubot dosubot bot added patch Bugfix & documentation PR plugin:table Tables labels Mar 29, 2026
@zbeyens
Copy link
Copy Markdown
Member

zbeyens commented Mar 29, 2026

Awesome, we were blocked on this one before Codex.
Note I did an update to task skill. Aiming best one-shot PRs with dev-browser and TDD.

@zbeyens zbeyens merged commit 1abf252 into udecode:main Mar 29, 2026
3 checks passed
@hhhjin hhhjin deleted the codex/table-arrow-navigation-caret-flash branch March 30, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bugfix & documentation PR plugin:table Tables size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants