onKeyEvent 'Escape' key submitting form

Corrected problem in function onKeyEvent when pressing escape key
(cherry picked from commit de99243e13ab9a8d23402536a7337a7d9a00555c)
Memory leak: events not purged

Memory leak, events in components no longer in DOM are not being purged
(cherry picked from commit a7fb0be39b2caed35a07838a3285137afd02ce44)