escape and space key stroke handling