This issue has been super tough to pin down. Basically, my site uses Stripe Elements (React Stripe JS) and I noticed on my Pixel 3a using Chrome 101.0.4951.61 (Android 12), that when I would tap on the CVC field, the browser zooms WAY in. This repros on React 17.0.2, and React 16.13.1. Also repros on a Moto G Play 2021 in Chrome. Does not seem to repro on iOS devices.
I don't know if it's relevant, but I'm working locally with IIS (ASP.NET 6), though this problem seems to be client-side specific.
To start investigating, I browsed similar Stripe examples, and did not repro this behavior in that code.
I then presumed the problem is with the way I'm implementing the Elements field. But, I've removed pretty much everything, including all CSS and all JS libraries other than react pretty much. I still see the problem locally.
Here are the relevant files from my local repro:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from '@stripe/stripe-js';
import CreditCardForm from './components/Example/CreditCard/CreditCardForm';
function renderApp() {
const stripePromise = loadStripe("pk_test_[XXXXXXXX]");
ReactDOM.render(
<Elements stripe={stripePromise}>
<CreditCardForm />
</Elements>,
document.getElementById('react-app')
);
}
renderApp();
and CreditCardForm:
import { CardElement } from '@stripe/react-stripe-js';
import * as React from 'react';
const InjectedCheckoutForm = () => {
return (<CardElement />);
};
export default InjectedCheckoutForm;
If it's helpful, here's my slimmed down package.json:
{
"name": "-",
"private": true,
"description": "",
"license": "Private",
"repository": "",
"version": "1.0.0",
"scripts": {
"build": "webpack --mode=development --watch",
"test": "jest",
"release": "webpack --mode=production",
"publish": "npm run release && dotnet publish -c Release"
},
"dependencies": {
"@stripe/react-stripe-js": "1.8.1",
"@stripe/stripe-js": "1.30.0",
"react": "16.13.1",
"react-dom": "16.13.1"
},
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "17.0.39",
"@types/react-dom": "17.0.13",
"ts-loader": "9.3.0",
"tslib": "2.4.0",
"typescript": "4.7.2",
"webpack": "5.72.1",
"webpack-cli": "4.9.2"
}
}
As I was widdling down my sample, I was comparing with: https://codesandbox.io/s/3qcsr which I forked into: https://codesandbox.io/s/react-stripe-js-minimal-forked-repro-attempt-jb43o4?file=/src/index.js and basically removes all styling. Neither of these reproduces the problem. I don't know what is different about my code vs these sandboxes. I can try to post a repro of this, but for now, I was wondering if anyone else has seen similar behavior.
Here's a video taken from my phone showing the problematic behavior. Simply tapping on the CVC field causes it to become super zoomed in. This doesn't happen for any other field.
(I suggest you play the video full screen; otherwise the CVC field is covered by a toolbar button)