fix ToggleSwitch state incorrect if not visible

Closes #658