facebook / facebook/lexical

Bug: Invalid HTML element nesting for image node

Open
#4,958 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

Lexical version: 0.12.0

## Steps To Reproduce

1. Insert an image node in the playground

## The current behavior

Inserting an image node results in the following DOM structure:

```html



Yellow flower in tilt shift lens



```

This markup is invalid as `

` and `` are inline elements and they cannot contain block elements such as `

`

## The expected behavior

Invalid DOM nesting. The draggable div can be converted to a span element to fix this.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by inserting an image node in the playground and inspect the resulting DOM structure shown in the report. Find the image node rendering entry point and change the draggable div to an inline element, then verify that the generated paragraph and image markup no longer contains invalid nesting.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.