Placeholder does not behave like a placeholder
- Dominant language
- TypeScript
- Stars
- 23.9k
- Forks
- 2.2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 55
Description
When setting the `placeholder` property (JSX.Element) for the PlainTextPlugin it adds the JSX.Element as element to the DOM after the editor `div`. This is incorrect placeholder behavior as it just another element in the DOM. It would be expected that the placeholder becomes an actual placeholder property for the editor `div` which has property `contentEditable=true`.
Lexical version: 0.9.0
```
}
placeholder={props.placeholder &&
ErrorBoundary={LexicalErrorBoundary}
/>
```
## The current behavior
The placeholder is added is element to the DOM after the editor `div`.
## The expected behavior
The placeholder is a property of the editor `div` that sets a placeholder text when the editor is empty like with below CSS.
```
[contentEditable="true"]:empty:not(:focus):before {
content: attr(placeholder)
}
```
Contributor guide
Assessment
This issue has not been assessed yet.