Fixes keyboard event capture.