weareseeed / react-square-web-payments-sdk

Easily create PCI-compliant inputs to accept payments online with the Square Payments API. It supports the following payment methods: credit and debit cards, ACH bank transfers, Apple Pay, Google Pay, Gift Cards and Afterpay/Clearpay.
https://react-square-payments.weareseeed.com/
MIT License
33 stars 35 forks source link

Allow specifying autofocus of CreditCard #74

Closed laviddichterman closed 1 year ago

laviddichterman commented 1 year ago

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

Description

By setting a default value for the 'focus' parameter of CreditCard, you cannot disable the autofocus on form loading in TypeScript without using a @ts-ignore annotation.

See

<CreditCard 
// @ts-ignore 
focus={""}  />

Trying to set it as focus={undefined} still results in the default value being set. By not setting a default, customization is allowed for this field. And it seems I'm not the only person looking for this functonality:

See https://developer.squareup.com/forums/t/how-to-remove-focus-when-squarepaymentsform-and-creditcardinput-is-rendered-in-the-ui/6449 🧡 Thank you!