I want to make an action when the cancel key is pressed, but is there a lifecycle for this, where can I write the code?