Case ce-0123-html-entities-paste · Scenario scenario-html-entity-encoding

HTML entities are decoded inconsistently when pasting

OS: Windows 11 Device: Desktop or Laptop Any Browser: Chrome 120.0 Keyboard: US Status: draft
html entity encoding paste chrome

Phenomenon

When pasting content that contains HTML entities (<, >, &, etc.), the entities may be decoded to actual characters or preserved as entities inconsistently. This causes issues with special characters.

Reproduction example

  1. Copy text containing HTML entities (e.g., <div>)
  2. Paste into contenteditable element
  3. Observe the DOM

Observed behavior

  • Entities may be decoded: <div> appears in DOM
  • Or entities may be preserved: &lt;div&gt; in DOM
  • Behavior is inconsistent
  • Special characters may be lost or changed

Expected behavior

  • Entity handling should be consistent
  • Or behavior should be predictable
  • Special characters should be preserved correctly
  • Encoding/decoding should be explicit

Browser Comparison

  • Chrome/Edge: Entity handling inconsistent (this case)
  • Firefox: Similar inconsistent behavior
  • Safari: Entity handling varies

Notes and possible direction for workarounds

  • Normalize entity encoding after paste
  • Decode or encode entities explicitly
  • Handle special characters carefully
  • Document expected entity behavior
Clipboard
<div>
Copied HTML entities
→
❌ After Paste (Bug - Decoded)
Entities decoded and inserted as actual HTML tags
vs
✅ Expected
<div>
Expected: Consistent entity handling (preserve or decode)

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-0123-html-entities-paste Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0132-html-entities-copy Windows 11 Desktop or Laptop Any Chrome 120.0 US draft
ce-0162-html-entities-serialization Windows 11 Desktop or Laptop Any Chrome 120.0 US draft

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: Windows 11
Device: Desktop or Laptop Any
Browser: Chrome 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.