Skip to content

Preserve block identity when editing from the block's start #550

Description

@horacioh

Describe the bug
At Mintter block Identity is really important. Specially because we let users create references to content inside blocks using its ID. I Notice that when I press Enter or Backspace in front of any block with content. I understand block identity might not be relevant to most use cases, but I find this could be a problem when you rely on content being accessible by a particular block ID.

To Reproduce

  1. write some content in a block and remember the block id
  2. move the cursor to the beginning of the block
  3. press Enter or Backspace (backspace if you are not on the first block of the document or of a nested list)
  4. see the blockID changed to the current block content.

Here's a video showing how the ID of the block changes when I press Enter in front of a block

Screen.Recording.2024-01-29.at.12.53.39.mov

And here's what happens when pressing Backspace in front of a block

Screen.Recording.2024-01-29.at.12.55.05.mov

How to solve this

I did some work to solve this on our side, and if this is relevant to the library I can share the solution with it.

Activity

  1. matthewlipski commented on Jan 31, 2024

    @matthewlipski
    Collaborator

    Hmm I think this is a slightly more complex issue than it seems at first:

    Enter:
    I think generally, content right of the cursor should get moved into a new block with a new ID, while the original ID stays in the original block. This makes intuitive sense imo for each cursor position except for at the start of the block. When the cursor is at the start of the block, I can see why you might expect the block to just get moved down, but instead it gets split, since the behaviour is the same as the other scenarios. So I'm not 100% sure about changing the behaviour for when the cursor is at the start of the block since the logic would be inconsistent.

    Backspace:
    This one is also tricky since you're merging 2 blocks, meaning you have to choose which ID to use. I would argue that it's the bottom block being merged into the block above, rather than the other way round, so I think it makes sense to use the ID of the previous block.

    @YousefED Any thoughts on this?

  2. YousefED commented on Jan 31, 2024

    @YousefED
    Collaborator

    @matthewlipski I think you diagnosed the issue correctly; it sounds like it is because we have generic code for merging and splitting blocks. I think it would make sense to make some exceptions for when one of the blocks is empty.

    @horacioh I'm also curious to hear your fix! thanks for reporting, I agree it's an important issue

  3. added
    needs-triageIssue has not yet been reviewed or classified by maintainers.
    on Feb 5, 2026
  4. added
    bug:P3Medium: Noticeable but non-blocking issues.
    and removed
    needs-triageIssue has not yet been reviewed or classified by maintainers.
    on Feb 23, 2026
  5. andrictham commented on May 2, 2026

    @andrictham

    It’s not just block identity: this is an issue too if the block in question is a check list item.

    If you press return at the start of the block, the text moves to a new line but not the checked state.

    If you look at how Notion handles it, the checked state of the block moves along with the text to a new line.

    Pressing return at the start of the block should create a new empty block above it; that feels more consistent with how users expect it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:P3Medium: Noticeable but non-blocking issues.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions