Cleanup and fix keyboard event handling in editor headers