Skip to content

Commit a8abdd6

Browse files
fix(payments-next): [Payments-Next Subscription] The Card section borders are cut off
Because: * The bottom border of the bottom payment method is cut off when users want to add a new card under "Manage payment methods." This commit: * Hides overflow while loading (to prevent bug [PAY-3236](https://mozilla-hub.atlassian.net/browse/PAY-3236) ) then does not hide overflow when Element is ready. Closes #[PAY-3280](https://mozilla-hub.atlassian.net/browse/PAY-3280)
1 parent f442efe commit a8abdd6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • libs/payments/ui/src/lib/client/components/PaymentMethodManagement

libs/payments/ui/src/lib/client/components/PaymentMethodManagement/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ export function PaymentMethodManagement({
4747
const [isNonDefaultCardSelected, setIsNonDefaultCardSelected] =
4848
useState(false);
4949
const [isNonCardSelected, setIsNonCardSelected] = useState(false);
50+
const [hideOverflow, setHideOverflow] = useState(true);
5051

5152
const handleReady = () => {
5253
setIsReady(true);
5354
};
55+
const handleElementReady = () => {
56+
setIsReady(true);
57+
setTimeout(() => setHideOverflow(false), 300);
58+
};
5459

5560
const handlePaymentElementChange = (
5661
event: StripePaymentElementChangeEvent
@@ -237,10 +242,11 @@ export function PaymentMethodManagement({
237242
)}
238243
<Form.Field name="payment">
239244
<Form.Control asChild>
240-
<div className="relative overflow-hidden">
245+
<div className={`relative ${hideOverflow ? 'overflow-hidden' : ''}`}>
241246
<PaymentElement
242247
onChange={handlePaymentElementChange}
243248
onLoaderStart={handleReady}
249+
onReady={handleElementReady}
244250
options={{
245251
layout: {
246252
type: 'accordion',

0 commit comments

Comments
 (0)