Case ce-0056-contenteditable-with-placeholder · Scenario scenario-placeholder-behavior

Placeholder text disappears when contenteditable receives focus

OS: macOS Ubuntu 22.04 Device: Desktop or Laptop Any Browser: Safari 120.0 Keyboard: US Status: draft
placeholder focus safari

Phenomenon

When using CSS ::before or ::after pseudo-elements to create placeholder text for a contenteditable region, the placeholder disappears immediately when the element receives focus, even if the content is empty. This differs from <input> and <textarea> behavior.

Reproduction example

  1. Create a contenteditable div with placeholder styling:
    [contenteditable]:empty::before {
      content: "Type here...";
      color: #999;
    }
  2. Focus the contenteditable.
  3. Observe whether the placeholder disappears.

Observed behavior

  • In Safari on macOS, the placeholder disappears on focus even if content is empty.
  • This differs from standard input elements where placeholder persists until text is entered.
  • The behavior is inconsistent with user expectations.

Expected behavior

  • Placeholder should persist when focused if content is empty.
  • It should disappear only when content is actually entered.
  • Behavior should match standard input elements.

Browser compatibility matrix

This matrix shows which browser and OS combinations have documented cases for this scenario. The current case is highlighted. Click on a cell to view other cases.

Current case
Confirmed
Draft
— No case documented

All variants (detailed table)

Complete list of all cases for this scenario with full environment details.

Case OS Device Browser Keyboard Status
ce-0056-contenteditable-with-placeholder macOS Ubuntu 22.04 Desktop or Laptop Any Safari 120.0 US draft
ce-0568-chrome-android-placeholder-korean-ime Android 14.0 Smartphone Any Chrome 131.0 Korean (IME) confirmed

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: macOS Ubuntu 22.04
Device: Desktop or Laptop Any
Browser: Safari 120.0
Keyboard: US
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.