Properly handle events to show/hide the options container