Skip to content

fix: Selection handling when clicking editor padding #1629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

matthewlipski
Copy link
Collaborator

In #731, we broke some things with block styling & selection handling on click, which we didn't fix 100% correctly. One issue that still remains from these changes is the selection moving to the start of the block instead of the end, when clicking the padded area on the right of the area (see #1588 for more detail). The issue is specific to Chrome only.

The reason for this bug is due to the :before pseudo-element on each .bn-block-content element. Previously, the .bn-block-content element was display: block, and so it's :before pseudo-element took on display: inline. However, we then changed .bn-block-content to be display: flex, forcing the :before pseudo-element to take on display: block. Because it was being displayed as a block, and therefore had the same height as the block, this confused Chrome's selection handling behaviour on click.

This PR reverts the .bn-block-content element to be display: block, which fixes the issue. I've made sure that all vanilla blocks still look identical, and that at least the custom blocks from our examples are all good too. Additionally, I've fixed some minor issues that we didn't notice before due to the display: flex.

Copy link

vercel bot commented Apr 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Apr 22, 2025 3:53pm
blocknote-website ✅ Ready (Inspect) Visit Preview Apr 22, 2025 3:53pm

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.

lgtm

Copy link

pkg-pr-new bot commented Apr 22, 2025

Open in StackBlitz

@blocknote/ariakit

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

@blocknote/code-block

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

@blocknote/core

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

@blocknote/mantine

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

@blocknote/react

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

@blocknote/server-util

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

@blocknote/shadcn

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

@blocknote/xl-docx-exporter

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

@blocknote/xl-multi-column

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

@blocknote/xl-odt-exporter

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

@blocknote/xl-pdf-exporter

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

commit: f7a7ead

@matthewlipski matthewlipski merged commit e673c82 into main Apr 22, 2025
8 checks passed
@matthewlipski matthewlipski deleted the editor-padding-click-fix branch April 22, 2025 16:22
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.

2 participants