API to capture the key event outside the form