Skip to content

fix(core): call scrollIntoView() on Enter#2802

Open
Wqrld wants to merge 2 commits into
TypeCellOS:mainfrom
Wqrld:fix/split-block-scroll-into-view
Open

fix(core): call scrollIntoView() on Enter#2802
Wqrld wants to merge 2 commits into
TypeCellOS:mainfrom
Wqrld:fix/split-block-scroll-into-view

Conversation

@Wqrld
Copy link
Copy Markdown

@Wqrld Wqrld commented May 30, 2026

Summary

Updates the enter handler to scrollintoview both globally and for listItems.

Part of #2801

Rationale

Without this handler, the cursor goes out of frame when pressing enter on the last line in the window

Changes

adds a scrollintoview call for the normal and listitem enter handler

Impact

None expected.

Testing

Tested in the playground environment. Does not overscroll the margins yet as in the demo video.

Screenshots/Video

See referenced issue

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

There should be support for configuring the margin aswell (see original issue). I can try to add that here or in a separate PR

Disclaimer: Code was AI assisted, but tested by a human and PR text is human.

Summary by CodeRabbit

  • New Features

    • Allow passing editor configuration props (excluding internally managed attributes and paste handling) when creating the editor, enabling safer customization of editor behavior.
  • Bug Fixes

    • Improved scrolling when pressing Enter to split blocks or list items so newly created content is automatically scrolled into view.

updates the enter handler to scrollintoview both globally and for listItems.

Signed-off-by: Wqrld <wereld03@gmail.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@Wqrld is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Adds viewport scrolling for newly created blocks when splitting with Enter (both list-item handler and keyboard shortcut). Also exposes a restricted editorProps option on BlockNoteEditorOptions and uses it during TipTap initialization while BlockNote retains control of attributes and transformPasted.

Changes

Enter key scroll behavior

Layer / File(s) Summary
Scroll into view on block split
packages/core/src/blocks/utils/listItemEnterHandler.ts, packages/core/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts
List item Enter handler assigns split result, calls tr.scrollIntoView(), and returns the result. KeyboardShortcuts adds .scrollIntoView() to the split command chain before .run().

BlockNote editorProps option

Layer / File(s) Summary
Expose and consume restricted editorProps
packages/core/src/editor/BlockNoteEditor.ts
Adds `editorProps?: Omit<NonNullable<EditorOptions['editorProps']>, 'attributes'

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Suggested reviewers

  • nperez0111
  • matthewlipski

Poem

🐰 A hop, a split, a page made new,
The viewport follows each cursor's cue,
Options tucked where settings stay,
Editors listen, then display,
I nibble bugs and hop away. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding scrollIntoView() calls to the Enter key handler across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description follows the template with all major sections present: Summary, Rationale, Changes, Impact, Testing, Screenshots/Video, and Additional Notes. The description clearly explains the issue being fixed and testing approach.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@Wqrld
Copy link
Copy Markdown
Author

Wqrld commented May 30, 2026

Would you be willing to promote editorprops to something that does not need accessing the internal _tiptapOptions so the margins and maybe other editorprops can be set nicely?

(Ref workaround diff in the original issue)

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