Perhaps you should check if "modal" is true. Most likely if its "modal" mode, then do nothing, else do the hide.