First and last space of contenteditable nodes turn into  

Author: sPaCeMoNk3yIamCreated Aug 2, 2016Updated Aug 14, 2024
Labelseasy first bugbugbrowser-chrome

Description

If a contenteditable is split up into several nodes (e. g. by formatting) and one either deletes the last whitespace of a preceding or the first whitespace of a succeeding node and enters a whitespce again, this whitespace will be a non-breaking space.

Steps to reproduce

  1. Have several text nodes within a contenteditable
  2. Delete a leading or trailing whitespace
  3. Reenter a whitespace

Expected behavior: I expect no   when entering a simple whitespace. I only expect a non-breaking space when I specifically enter it (e. g. SHIFT + SPACE).

Actual behavior: Non-breaking spaces occur and are hard to tell for an author, without inspecting the website.

Link to an example: https://jsfiddle.net/spacemonk3y/406j52d7/ I built a simple example. Just delete the whitespce in front of the bold "foobar" and enter it again. I'll see a non-breaking space when inspecting with web developer tools. To see it happen also after "foobar", just add a second whitespace before "was" and delete it again. You'll see a   now...

Versions

  • medium-editor: none, since it's a contenteditable / browser problem
  • browser: Chrome 51
  • OS: Mac OS El Capitan 10.11.5