Placeholder breaks first character of Hangul composition
OS: Android 14.0 · Device: Smartphone Any · Browser: Chrome 131.0
Open case →Scenario
Technical analysis of how CSS and attribute-based placeholders disrupt text insertion and IME sessions.
Standard <input> and <textarea> elements have native placeholder support. contenteditable does not. Developers typically simulate placeholders using the CSS :empty:before selector or by injecting a pseudo-node. This simulation often creates a “Race Condition” where the browser’s logic for removing the placeholder collides with the user’s logic for inserting text, particularly during the startup of an IME session.
In Chrome 131+ on Android, when the first character of a Korean syllable is typed, the DOM mutation triggered by CSS removing the :before placeholder (because the element is no longer :empty) causes the browser to reset its internal IME buffer.
/* Chrome Logic Loop */
// 1. User types 'ㅎ'
// 2. Element is no longer :empty
// 3. CSS pseudo-element is destroyed
// 4. Mutation event clears the text node 'ㅎ' incorrectly
In Safari, the placeholder often remains visible until a character is typed, but if the placeholder has different padding/font than the text, focusing it can cause a “jump” that moves the caret unexpectedly.
:empty transitions safely but may fail to render a caret in zero-height divs.Instead of allowing :empty to destroy the node, toggle its visibility or opacity based on a manually maintained is-empty class or the focus state.
/* Avoid content: "" changes mid-type */
[contenteditable]::before {
content: attr(placeholder);
opacity: 0.5;
}
[contenteditable]:not(:empty)::before,
[contenteditable]:focus::before {
display: none; /* or visibility: hidden */
}
Explicitly remove the placeholder state when the element is focused, before any composition events fire.
Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.
Each row is a concrete case for this scenario, with a dedicated document and playground.
| 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 |
This matrix shows which browser and OS combinations have documented cases for this scenario. Click on a cell to view the specific case.
| Browser | Android | macOS |
|---|---|---|
| Chrome | — | |
| Safari | — |
This scenario affects multiple languages. Cases are grouped by language/input method below.
OS: Android 14.0 · Device: Smartphone Any · Browser: Chrome 131.0
Open case →OS: macOS Ubuntu 22.04 · Device: Desktop or Laptop Any · Browser: Safari 120.0
Open case →Other scenarios that share similar tags or category.
Automatic scroll-to-caret may fail when the editable is inside nested scrollers, overflow hidden ancestors, or during rapid input—the user loses sight of the insertion point without manual scroll.
Managing browser UI collisions, virtual keyboard resizing, and IME candidate window positioning.
After the user or the page scrolls while editing in iOS Safari, the caret may render in the wrong place, disappear until the next tap, or sit outside the visible viewport—especially with fixed headers or virtual keyboard resize.
On some mobile browsers, focusing a contenteditable programmatically or from a non-gesture path may not raise the virtual keyboard—users cannot type until they tap again.
Mobile browsers may scroll the page to bring the focused field into view when the virtual keyboard opens—sometimes overscrolling or hiding fixed UI and the caret.
Have questions, suggestions, or want to share your experience? Join the discussion below.