threema-ch / threema-web

The Threema Web application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing placeholder text in compose area when deleting multiple lines

threema-danilo opened this issue · comments

Bug Description

Sometimes the compose doesn't show a placeholder text even though it's empty.

screenshot-20240402-173506

Steps to Reproduce (for bugs)

Firefox:

  1. Type "a<shift+enter>b"
  2. Press ctrl+a to select all text
  3. Press ctrl+x to cut text

Chromium:

  1. Type "a<shift+enter>b"
  2. Press ctrl+a to select all text
  3. Press ctrl+x to cut text
  4. Paste text, and repeat steps 2 and 3

In both situations, the contenteditable div now contains a single <br> which prevents the placeholder from showing up.

Your Environment

  • Threema Web version: 2.5.3
  • Browser name and version: Firefox 124.0.1 / Chromium 123
  • Computer operating system and version: Arch Linux

Seems like this fix stopped working:

// If the compose area contains only a single <br>, make it fully empty.
// See also: https://stackoverflow.com/q/14638887/284318
const text = composeArea.get_text(true);
if (text === '\n') {
composeDiv[0].innerText = '';
}