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

Mitigation: Custom Amounts CTA not being tappable unless keyboard is manually dismissed #13994

Merged
merged 6 commits into from
Sep 30, 2024

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Sep 18, 2024

Closes: #13955

Description

We’ve seen some instances where the Custom Amounts CTA button is not tappable unless the keyboard is manually dismissed first, this issue hasn’t been replicable consistently, but we can infer that either the keyboard layout is interfering with the button tap gesture, or the timing of SwiftUI managing the keyboard vs the view dismissal.

We attempt to mitigate this problem by:

  • Allowing keyboard dismissal when a merchant taps anywhere else within the view. Adding this within the button closure wouldn’t work, as if the button happens to be non-tappable due to the keyboard layout constraints, we wouldn’t be able to call it’s dismissal either.
  • Alleviate potential layout conflicts involving the keyboard within SwiftUI by ignoring the keyboard safe area.

Testing information

As shared in the PR issue, this is cannot be consistently reproduced, but we can run the flow a few times and test the changes:

  • On a physical device, start order creation
  • Add a few products
  • Tap "Add Custom Amount" > Select any option
  • Enter details
  • Tap the CTA "Add Custom Amount" to save the changes
  • Notice that the tap works normally, the keyboard is dismissed, as well as the view
  • Observe that when the keyboard is open, you can tap outside to dismiss it, then tap again within the name text field or the number textfield (limited to where the actual placeholder is) in to make the keyboard appear again.

No new Unit Tests have been added, as it's merely an UI update.

Since the keyboard dismissal logic is encapsulated to this view only, we've just added as an extension of the view. We can move this to the view model if you prefer, but I opted to keep it in the view since we don't need to expose it to other views through the view model if the problem hasn't been reported anywhere else.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

We’ve seen some instances where the CTA button is not tappable unless the keyboard is manually dismissed, this issue hasn’t been replicable consistently thought.

We attempt to mitigate this problem by allowing keyboard dismissal when a merchant taps anywhere else within the view. Adding this within the button closure wouldn’t work, as if the button happens to be non-tappable due to the keyboard layout constraints, we wouldn’t be able to call it’s dismissal either.
@iamgabrielma iamgabrielma added the feature: order creation All tasks related to creating an order label Sep 18, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 18, 2024

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@iamgabrielma iamgabrielma added this to the 20.5 milestone Sep 18, 2024
@iamgabrielma iamgabrielma added the type: task An internally driven task. label Sep 18, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 18, 2024

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr13994-e807202
Version20.6
Bundle IDcom.automattic.alpha.woocommerce
Commite807202
App Center BuildWooCommerce - Prototype Builds #11049
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@iamgabrielma iamgabrielma modified the milestones: 20.5, 20.6 Sep 20, 2024
@iamgabrielma iamgabrielma added the type: bug A confirmed bug. label Sep 20, 2024
@selanthiraiyan selanthiraiyan self-assigned this Sep 23, 2024
Copy link
Contributor

@selanthiraiyan selanthiraiyan left a comment

Choose a reason for hiding this comment

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

The reasoning for dismissing the keyboard upon tapping the view sound good to me. 👍

I tested on an iPhone running iOS 18.0 and didn't face issues with dismissing the keyboard 🚢

@iamgabrielma iamgabrielma modified the milestones: 20.6, 20.7 Sep 27, 2024
@iamgabrielma iamgabrielma merged commit 89d2c06 into trunk Sep 30, 2024
14 checks passed
@iamgabrielma iamgabrielma deleted the issue/13955-mitigate-non-tappable-cta branch September 30, 2024 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order creation All tasks related to creating an order type: bug A confirmed bug. type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Order] Add Custom amount - Unable to tap CTA when keyboard visible
4 participants