Skip to content

[Commenting] - adding new comment causes editor to go display blank content #52

Open

Description

@zeigerpuppy

On testing of core-comments branch...

Have noticed issue, when adding new comment, the editor pane displays empty text content and markers on all lines.

Image

To reproduce:

  1. open document
  2. select a portion of text
  3. click on "Add comment" in comment pane - add comment and submit
  4. The editor pane now shows a blank view with comment markers on each line

It doesn't look like content is lost.
In some cases, a force-reload brings the content back to a normal view. In other cases, the content can't be seen with a force-reload in the editor pane. The preview pane shows correct content.

No console error messages, looks like a rendering issue.

Also noticed in a document which I could reveal by reload, that a line break has been inserted in the editor before the comment anchor, even though there is no line break in text there.

Image

Activity

  1. zeigerpuppy commented on Jun 26, 2026

    @zeigerpuppy
    Author

    Interestingly, another way to recover the rendering failed condition is to reload the document in another account (shared workspace).

  2. MuNeNiCK commented on Jun 28, 2026

    @MuNeNiCK
    Member

    I've addressed this in the core comments work.

    The editor-side comment marker rendering no longer uses Monaco glyph-margin decorations for core comments. Those decorations were the likely source of the blank editor / marker-on-every-line rendering failure. Core comment markers are now rendered as one Monaco content widget per commented line, with grouped same-line comments handled by a single grouped marker.

    I also changed the hidden markdown comment anchor rendering so the <!--comment:...--> anchor remains in the document model but has zero visual width in the editor. This avoids the extra visual spacing / apparent line break around anchors while still keeping the anchor in markdown.

    I verified this with a browser E2E flow on the local app: create a document, select text, add a comment, confirm exactly one editor marker, confirm preview marker rendering, confirm the comment panel entry, and confirm the hidden anchor contributes zero layout width.

  3. zeigerpuppy commented on Jun 29, 2026

    @zeigerpuppy
    Author

    Thanks @MuNeNiCK

    I have tried the latest changes. The extra markers in the editor are gone.
    However, now I don't see any markers at all in the editor pane and the line breaks around the comment anchor are still occurring for me.

    Screenshot from Chromium:

    Image

    Also noticed that if I edit the document, the text disappears at the end of the typing (I guess when comment markers should be re-rendering). The editor is also flickering, maybe re-rendering is breaking here?

    Image
  4. MuNeNiCK commented on Jun 29, 2026

    @MuNeNiCK
    Member

    Thanks for retesting and for the screenshots.

    I found that my previous follow-up was still too fragile. The editor-side marker rendering has now been reworked again:

    • core comment markers are rendered through Monaco glyph-margin decorations, so they stay tied to editor lines instead of floating content widgets
    • the hidden <!--comment:...--> anchor is handled as a separate inline decoration with explicit stickiness/letter-spacing handling
    • comment decorations are rebuilt from the current Monaco model content after edits, so typing should no longer leave the raw anchor visible or cause the editor pane to blank/flicker
    • newly created comments now use a compact marker id instead of a full UUID, which reduces line-wrap disruption around anchors

    I verified this locally with browser E2E flows for both cases:

    1. an existing long UUID-style comment anchor, then typing after it
    2. creating a new comment through the UI and confirming the compact anchor, one editor marker, preview marker, and comment panel entry

    I have this committed locally on the core-comments branch and will push it with the branch update once the remaining issue-level fixes are ready.

  5. zeigerpuppy commented on Jul 6, 2026

    @zeigerpuppy
    Author

    Tried the latest commits and getting some unusual behaviour in the editor.

    When an existing comment line is selected or a new edit made, the renderer starts flickering - in the video below, you can see the comment markers appearing/disappearing quickly.

    When that is happening, it's no longer possible to edit (reloading page works to stop the flickering, but only temporarily)

    I think there may be an issue with the hiding of the comments which is causing the flicker. It also looks to be related to line breaks where there shouldn't be any. Happy to test.

    2026-07-06.23-36-23.webm
  6. aswinm commented on Aug 5, 2026

    @aswinm

    The screen kept refreshing continuously due to the content PUT request being triggered multiple times. I have pushed a fix here - #57

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions