If the message the user typed in ends with a newline, the signature is appended with a leading space causing an interpretation as preformatted text. The code should check wether the message ends with \n and remove this.
Version: 1.20.x
Severity: minor
URL: https://www.mediawiki.org/wiki/Visual_editor/Feedback