onEscapeKeyPressed fires when the shopper presses the literal Escape key while the element (or one of its sub-fields) has focus. Use it to close your own modals, blur the input, or restore prior UI state.
Payload
The key is always Escape by definition, so the payload carries only elementType.
Example
The SDK does not preventDefault()
Default browser behavior (for example, dismissing a native autofill panel) is preserved. Merchants own the response.
applePay, googlePay, and submitButton do not emit this event. The event key is omitted from their event map, so subscribing is a TypeScript error and a runtime no-op (with a console warning).
- Wallets render inside their own rendering surface, whose native payment sheet captures keystrokes once open.
submitButton has no shopper-dismissable input.
To react to a shopper abandoning a wallet sheet, subscribe to onExit instead.
Per-element wiring
- Single-input elements (
email, phone) attach the key listener directly to the input.
- Multi-input elements (
fullName, billingAddress, shippingAddress, manual-mode bank, checkout) attach the listener to the wrapper element and let the keystroke bubble from whichever sub-field had focus. The event fires once per keypress regardless of which sub-field was active.
bank fires only in manual mode. Address-lookup mode is a launch button to an external modal whose keyboard handling is out of the SDK’s reach.
Coverage gap on card
Card secured fields (card number, expiration, security code) own keystrokes inside their own rendering surface, which does not expose an Escape callback. Coverage is best-effort:
- Pressing Escape inside the holder-name or postal-code inputs fires the event.
- Pressing Escape inside one of the secured card fields does not.
See also
Last modified on July 17, 2026