Skip to content

Conversation

@matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Dec 15, 2025

Summary

This PR fixes some issues with overflowing placeholders when there is not enough space to display them on one line.

Rationale

This was causing issues on mobile especially, since viewports can get pretty small.

Changes

  • Moved placeholders to .bn-block-content:after elements instead of .bn-inline-content:before.
  • Removed position: absolute and other styles from placeholders.
  • Made .bn-inline-content elements no longer span container width.
  • Adjusted placeholder styles.

Impact

I was wary of making .bn-inline-content elements no longer span container width due to #1523 and #1553, as we've had some cursor selection issues related to that before. However, I've done some fairly extensive manual testing across browsers against the preview from #731 (PR that broke the selection referenced in #1553), and everything looks good.

Testing

N/A

Screenshots/Video

Before:

Screen.Recording.2025-12-15.at.15.42.52.mov

After:

Screen.Recording.2025-12-15.at.15.41.25.mov

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

@vercel
Copy link

vercel bot commented Dec 15, 2025

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

Project Deployment Review Updated (UTC)
blocknote Ready Ready Preview Dec 15, 2025 6:30pm
blocknote-agent-demo Error Error Dec 15, 2025 6:30pm
blocknote-website Ready Ready Preview Dec 15, 2025 6:30pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 15, 2025

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@2291

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@2291

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@2291

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@2291

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@2291

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@2291

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@2291

@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@2291

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@2291

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-email-exporter@2291

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@2291

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@2291

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@2291

commit: 28b1f44

Copy link
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

Looks about right to me

@YousefED
Copy link
Collaborator

In my experience, changes to these CSS rules can have unintended consequences and should be tested well across browsers (and probably we need to increase our e2e coverage here).

E.g., when I try this PR and this scenario on Chrome:

image

I can't navigate to the empty list element with arrow up / down anymore

Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

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

see comment

@matthewlipski
Copy link
Collaborator Author

I changed the approach - the hacky workaround of hiding the trailing break element has been removed and the placeholder is now rendered in the parent .bn-block-content element instead. This should avoid the issues with mouse and keyboard selection and still fixes the same issue as #2251.

Copy link
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

Seems to look good from my testing, would prefer to have @YousefED look at this though

Comment on lines -43 to -45
.bn-inline-content {
width: 100%;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Double checked this, the previous issue #1523 seems to still be corrected with this in-place

.bn-block-content:has(.ProseMirror-trailingBreak:only-child):after {
font-style: italic;
/* Removes text cursor offset. */
margin-inline: -2px;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is to be able to show the text cursor underneath the placeholder.

There may be a way around this, by adding data attributes to make the width of the flex layout different based on whether the placeholder is showing or not.

But, doesn't seem to cause issues, may revisit if it does something weird

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.

4 participants