Skip to content

Conversation

@jvithlani
Copy link
Contributor

@jvithlani jvithlani commented Jan 12, 2026

Description

This PR ensures that a paragraph node always exists before and after a code block. Currently, the absence of these nodes prevents the up and down arrow keys from functioning correctly. This change guarantees a "buffer" node (defaulting to a paragraph) to ensure consistent keyboard navigation.

Closes #7912

Before

Screen.Recording.2026-01-13.at.2.25.51.AM.mov

After

Screen.Recording.2026-01-13.at.2.19.46.AM.mov

@vercel
Copy link

vercel bot commented Jan 12, 2026

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

Project Deployment Review Updated (UTC)
lexical Ready Ready Preview, Comment Jan 13, 2026 4:52am
lexical-playground Ready Ready Preview, Comment Jan 13, 2026 4:52am

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 12, 2026
@jvithlani
Copy link
Contributor Author

#7914 (comment)

Just added a new plugin, @etrepum let me know if this doesnt belong to playground folder

@etrepum
Copy link
Collaborator

etrepum commented Jan 13, 2026

It's fine to have it in the playground, but this implementation breaks the markdown view functionality which expects the editor to contain only a CodeNode. This plugin would have to be aware of that editor mode and disabled accordingly.

@etrepum
Copy link
Collaborator

etrepum commented Jan 13, 2026

You can run the e2e tests locally, have the playground running in one terminal with pnpm run start and run the tests in another with pnpm run test-e2e-chromium https://github.com/facebook/lexical/blob/main/CONTRIBUTING.md#pull-requests

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: create empty paragraph before/after code block if it's the first/last node

2 participants