Merge pull request #981 from woocommerce/pcp-966-prevent-enter

Prevent Enter key submit for our non-standard button gateways
This commit is contained in:
Emili Castells 2022-11-15 10:54:50 +01:00 committed by GitHub
commit 967e40633e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,16 @@ const bootstrap = () => {
const freeTrialHandler = new FreeTrialHandler(PayPalCommerceGateway, spinner, errorHandler);
jQuery('form.woocommerce-checkout input').on('keydown', e => {
if (e.key === 'Enter' && [
PaymentMethods.PAYPAL,
PaymentMethods.CARDS,
PaymentMethods.CARD_BUTTON,
].includes(getCurrentPaymentMethod())) {
e.preventDefault();
}
});
const onSmartButtonClick = (data, actions) => {
window.ppcpFundingSource = data.fundingSource;