The check for editor doesn't seem necessary, since mustShow would false, when editor is not truthy. You should also check that the panel wasn't already opened before scrolling.