refactor when the input box is hidden