Skip to content

fix: Tab causing indent in last table cell (BLO-1211)#2831

Open
matthewlipski wants to merge 2 commits into
mainfrom
table-cell-indenting
Open

fix: Tab causing indent in last table cell (BLO-1211)#2831
matthewlipski wants to merge 2 commits into
mainfrom
table-cell-indenting

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

@matthewlipski matthewlipski commented Jun 4, 2026

Summary

Normally, Tab/Shift+Tab cycles through table cells. In the first/last cell though, it should just no-op as there is no previous/next cell to cycle to. Instead, it nests/unnests the table block. This PR fixes that. You can still nest/unnest table blocks via the formatting toolbar.

Closes #2803

Rationale

This is inconsistent UX.

Changes

  • Updated keyboard handlers.

Impact

N/A

Testing

Added e2e tests.

Screenshots/Video

N/A

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Tab and Shift+Tab keyboard navigation behavior in tables to prevent unintended indentation changes when navigating between cells.
  • Tests

    • Added regression tests for table keyboard navigation.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
blocknote Error Error Jun 4, 2026 10:00am
blocknote-website Error Error Jun 4, 2026 10:00am

Request Review

@matthewlipski matthewlipski requested a review from nperez0111 June 4, 2026 09:18
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 019eef0c-d2c1-4926-a217-b9c8e6dab5cc

📥 Commits

Reviewing files that changed from the base of the PR and between ec9c151 and 145dcb2.

📒 Files selected for processing (2)
  • packages/core/src/blocks/Table/TableExtension.ts
  • tests/src/end-to-end/tables/tables.test.tsx

📝 Walkthrough

Walkthrough

Tab and Shift+Tab keyboard handlers in TableExtension are refactored to check whether the cursor is inside a table before invoking cell navigation. When outside a table, handlers return false to allow default browser behavior. When inside a table, handlers run goToNextCell(±1) and return true to consume the event. Regression tests verify that pressing Tab in the last cell and Shift+Tab in the first cell do not alter block structure.

Changes

Tab and Shift+Tab boundary handling

Layer / File(s) Summary
Tab/Shift+Tab handler refactoring with regression tests
packages/core/src/blocks/Table/TableExtension.ts, tests/src/end-to-end/tables/tables.test.tsx
Tab and Shift+Tab shortcuts now wrap goToNextCell in a command that checks isInTable(state), returning false when outside a table and true when inside, preventing indentation. Regression tests verify Tab in the last cell and Shift+Tab in the first cell are no-ops.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • nperez0111

Poem

🐰 Tab through tables without a fright,
No sneaky indents left or right!
Shift+Tab won't skip away,
Tables stay flat, come what may! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: preventing Tab from causing indent in the last table cell, and references the related issue (BLO-1211).
Description check ✅ Passed The description follows the template structure and covers most key sections: Summary, Rationale, Changes, Testing, and Impact, though some optional sections like Screenshots and certain checklist items are incomplete.
Linked Issues check ✅ Passed The PR directly addresses issue #2803 by preventing Tab/Shift+Tab from indenting/unindenting tables at cell boundaries, making those keys no-ops when no adjacent cells exist.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the Table Tab/Shift+Tab behavior and adding related e2e tests, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch table-cell-indenting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2831

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2831

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2831

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2831

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2831

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2831

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2831

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2831

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2831

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2831

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2831

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2831

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2831

commit: 145dcb2

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-2831/

Built to branch gh-pages at 2026-06-04 09:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

Tables are hard to un-nest

1 participant