Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: readOnly option in PaymentElement component when using Tabs layout #557

Open
Rahmon opened this issue Dec 20, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Rahmon
Copy link

Rahmon commented Dec 20, 2024

What happened?

Hello,

When I add the option readOnly in the PaymentElement component, I can't click on the other options:

image

However, if I switch the layout to accordion, I can click on the options:

image

If I let the Google option open and switch the layout to tabs, this selected option keeps open:

image

Expected behaviour: it seems that I should be able to click on the other options when the readOnly option is set to true and I am using the tabs layout.

Code example:

import * as React from "react";
import { Elements, PaymentElement } from "@stripe/react-stripe-js";
import { loadStripe } from "@stripe/stripe-js";

export default function Home() {
  const stripePromise = loadStripe("pk_test_6pRNASCoBOKtIshFeQd4XMUh");

  const stripeElementOptions = {
    mode: "payment",
    amount: 1099,
    currency: "usd",
  };

  const options = {
    layout: "tabs", // change the layout here to accordion or tabs
    readOnly: true,
  };

  return (
    <Elements stripe={stripePromise} options={stripeElementOptions}>
      <PaymentElement options={options} />
    </Elements>
  );
}

Environment

No response

Reproduction

No response

@Rahmon Rahmon added the bug Something isn't working label Dec 20, 2024
@alexlande-stripe
Copy link

Hi @Rahmon, thanks for the report. I've verified this is not working as intended (although I think the intended behavior is that accordion layout will also not allow you to change payment methods).

We're tracking this issue internally and will update here when a fix is rolled out.

Copy link

stale bot commented Jan 10, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 10, 2025
@alexlande-stripe
Copy link

Quick update, we've rolled out a fix for this and readOnly should now behave the same way for both tabs and accordion layouts.

@stale stale bot removed the stale label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants