google-pay / google-pay/google-pay-button

Button doesn't respect "plain" type sometimes, rendering a long version with card info

Open
#296 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
305
Forks
90
Avg merge
2d 2h
Merged PRs (30d)
7

Description

Describe the bug Button is rendered inconsistently when buttonType: 'plain' is used. Sometimes it still tries to include card information which results in min-width: 240px rule breaking narrow layouts.

To Reproduce Steps to reproduce the behavior:

  1. Open Chrome in incognito mode
  2. Go to modified jsfiddle Basic Example
  3. Observe a cut GPay button
    3.1 If button is rendered correctly, try to reload page a few times
    3.2 Alternatively, try to open a url with Android Chrome - the issue is always reproducible there

Parameters used to render the button (though it feels like buttonSizeMode and buttonRadius have no impact)

        buttonSizeMode: 'fill',
        buttonType: 'plain',
        buttonRadius: 9999,

Expected behavior Button respects passed parameters and doesn't try to render card info when buttonType: 'plain' is used

Screenshots
Correctly rendered button
Screenshot 2024-06-24 at 12 30 11
Incorrectly rendered button
Screenshot 2024-06-24 at 12 29 58

Component information:

Reproducible with a plain SDK. Initially found it with @google-pay/button-react however I believe it is applicable to other component libraries

  • Component
    • React component (@google-pay/button-react)
  • Component version (e.g. 1.0.0): 3.1.0

Environment:

  • Device: MacBook Pro M1 2021, Pixel 6 Pro
  • OS: MacOS 14.5, Android 14
  • Browser: Chrome MacOS 126, Safari MacOS 17.5, Chrome Android 126
  • Country/region: UK

Additional information
As mentioned in https://github.com/google-pay/google-pay-button/issues/292#issuecomment-2135879938, passing a deprecated buttonType: 'short' works as expected

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @google-pay/button-react implementation and reproduce the modified jsfiddle Basic Example, including on Android Chrome. Trace how buttonType: 'plain' selects card information and sizing, then verify that plain buttons omit card info and do not impose the min-width: 240px rule in narrow layouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, payments
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.