Skip to content

H1 headings saved without data-level cause hnull rendering and crash on hover #1932

@Baghlani

Description

@Baghlani

Describe the bug
When creating a heading block with level = 1, the serialized HTML stored in the database does not include the data-level="1" attribute.

This differs from other heading levels (H2, H3), which correctly include data-level="x" in the stored HTML.

As a result, when the HTML is later parsed and loaded into the editor, the H1 heading is mapped incorrectly to hnull. Interacting with this hnull block (for example, hovering over it) causes the editor to crash.

To Reproduce

Create a heading block with level = 1 (H1).

Save the document → check stored HTML → data-level attribute is missing.

Reload the document into the editor (HTML parsing).

The heading block is rendered as hnull.

Hover over the hnull heading → page crashes.

Expected Behavior
H1 blocks should be serialized with data-level="1" (same as other heading levels) so they parse correctly and do not produce hnull blocks.

Additional Notes

The issue appears to be in the serialization process for H1 headings.

Adding the missing data-level="1" to the stored text in DB, fixes the parsing/rendering issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions