The <legend> still appears but has no reason to, and the <br>'s appear if there's even one show/hide option, but they take way too much space.
The commit below removes the legend and removes all <br />'s, instead setting the <span>s that are left inside the fieldset to display:block; to simulate a line-break but only where it is actually needed (without redundant <br> breaks that show a lot more whitespace below the text)