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

[Android] fix: card field focus jumps back to the card number field #630

Merged
merged 7 commits into from
Mar 3, 2022

Conversation

arekkubaczkowski
Copy link
Collaborator

@arekkubaczkowski arekkubaczkowski commented Oct 7, 2021

closes #121
cardParams, paymentMethodCreateParams and paymentMethodCard properties have the side effect that when called it will shift the focus to an invalid field. In order to avoid this, we need to call it only when the card details are valid.

onValidCardChange()
} else {
cardParams = null
cardAddress = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this else case where it is not vali do you still need to sendCardDetailsEvent

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michelleb-stripe yes and I do this, you can find the calls in the particulars text fields listeners

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would mean that the CardValidCallback would always need to be followed by a TextWatcher. I am not sure this is a guarantee we can make.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michelleb-stripe I'm taking this over from Arek but I'm not sure I get this properly. Can you please help me understanding the problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@souhe Let me try to explain more. The setExpiryDateTextWatcher and setPostalCodeTextWatchedr called onCardChanged, which will get the paymentMethodCreateParams without first checking to see if they are valid. Because of how a query on the paymentMethodCreateParams works it will change the focus on the widget, to the first field that is invalid.

paymentMethodCreateParams should only be called from the CardValidCallback.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michelleb-stripe I'm afraid I'm still confused :D Are you describing your previous comment or this whole issues?

If the first one then I'm not getting why calling sendCardDetailsEvent from setExpiryDateTextWatcher or setPostalCodeTextWatcher would call paymentMethodCreateParams.

If the second one I'm still not sure what this means - I think that would mean that the CardValidCallback would always need to be followed by a TextWatcher. I am not sure this is a guarantee we can make. Why is that true? If I understand the code created by Arek properly we are sending sendCardDetailsEvent on every change from each watcher so that is why there is no need to send this even once again from cardValidCallback (when card is invalid)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. Looking at it again it looks good to me.

@Justin-Terry
Copy link

Any updates on this issue?

@ankit-carbonhealth
Copy link

@arekkubaczkowski @michelleb-stripe Any updates on when can this be shipped?

@charliecruzan-stripe charliecruzan-stripe merged commit 97b29e5 into master Mar 3, 2022
@charliecruzan-stripe charliecruzan-stripe deleted the fix/card-field-focus-jumps-back branch March 3, 2022 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If the credit card number is not filled in, or is in error, it jumps back to the credit card number
6 participants