onClick operation executes only after menu is being closed