Skip to content

fix: cursors will not break to new-line on firefox #1419 #1422

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 7 commits into from
Feb 10, 2025
Merged

Conversation

nperez0111
Copy link
Contributor

@nperez0111 nperez0111 commented Feb 10, 2025

This resolves an issue where in Firefox the cursor's caret was breaking to a new line in specific scenarios. Resolves (#1419)

Original issue:

Screen.Recording.2025-02-10.at.10.43.47.mov

After fix is applied:

Screen.Recording.2025-02-10.at.10.45.39.mov

You'll also notice I repositioned the label to actually line-up to the caret element. I felt like it just looked wrong otherwise.

Before:

image

After:

image

If this should be changed in another PR, then happy to do so, just wanted this to look great. Also willing to make the cursor thicker than 1 px it is right now

Copy link

vercel bot commented Feb 10, 2025

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Feb 10, 2025 0:45am
blocknote-website ✅ Ready (Inspect) Visit Preview Feb 10, 2025 0:45am

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.

🥳 yay, first PR!

I'm not sure about the design changes. The original thinking was to make the cursor look similar to how it is in Google Docs. Could you compare with that? The idea is imo that it's sort of a flag that expands

Also; ended up going for the outline version? Was that because it also solves the "zoom" issue?

@nperez0111
Copy link
Contributor Author

Got it, looked into google docs more & I think I nailed the look. Google docs on the left, blocknote on the right
image

@nperez0111
Copy link
Contributor Author

As for the outline approach, the zooming was fine with the display block, but I went with the outline because it better represents the intention here. Can't accidentally click on the cursor caret now too which is a nice bonus

@YousefED
Copy link
Collaborator

@nperez0111 oh no :( something we didn't think of; of course hovering the cursor to show the username doesn't work anymore if the cursor doesn't take any space (with the outline trick). It's now only possible to hover the "dot", not the caret. Ideas for a fix?

@nperez0111
Copy link
Contributor Author

@nperez0111 oh no :( something we didn't think of; of course hovering the cursor to show the username doesn't work anymore if the cursor doesn't take any space (with the outline trick). It's now only possible to hover the "dot", not the caret. Ideas for a fix?

Ah yea, didn't realize that was intended. zero-width element is definitely going to have that behaviour. So I'll go back to the display: inline-block

@nperez0111
Copy link
Contributor Author

Alright, tried another stab at it. With display: inline-block, it worked for firefox, but then zooming at specific sizes in chrome would be incorrect.

So, I went with the same outline approach, but now I'm overlaying the element with a pseudo element, specifically to capture the mouse events. This is a nice in-between because the pseudo element is absolutely positioned so it should have no effect on other elements (e.g. to break wrapping).

@YousefED
Copy link
Collaborator

Smart!! I think now there's only 1px white space between label and caret. After that we should be good to go!

image

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.

🙌

@nperez0111 nperez0111 merged commit e011cf4 into main Feb 10, 2025
4 checks passed
@nperez0111 nperez0111 deleted the BLO-102 branch February 10, 2025 12:53
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