Added a should dismiss method to handle tap outside events rather than relying on willDismiss to determine if the popover should disappear when tapped off