Make sure title is hidden if there is text

Fixes #2518 and #2528