Added delegate to prevent keyboard gesture from working in certain situations