w3c / w3c/editing

Safari/Chrome/Firefox: Caret Rendering inconsistent with empty placeholder across browsers

Open
#498 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

caret-movement
Dominant language
HTML
Stars
202
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Caret placement with pseudo element and br tag

In Chrome when we render a pseudo element as "placeholder" we expect the caret to render in front of the multiline pseudo element in an empty html element (contenteditable) (should also work with text-align: center)

<style>
[placeholder].empty::before {
  content: attr(placeholder);
}
</style>
<div class="empty" contenteditable="true" placeholder="Hello"><br></div>

Actual behaviour:
in Chrome: Caret is rendered in last line after the last character of the placeholder
in Safari: Caret is rendered in last line before the first character of the last of the placeholder

Repro: https://w3c.github.io/editing/repros/498.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked repro at https://w3c.github.io/editing/repros/498.html and inspect the contenteditable example using a pseudo-element placeholder and br tag. Compare caret placement in Chrome, Safari, and Firefox, including the centered text case. Done means the expected caret behavior and any required specification or repro updates are agreed and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.