-
Notifications
You must be signed in to change notification settings - Fork 709
Fix Samsung keyboard covering inputs in embedded components #12287
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
base: master
Are you sure you want to change the base?
Conversation
|
Diffuse output: APK |
|
This change looks good to me but I'm not an Android expert. Maybe @maragues-stripe could take a look. |
maragues-stripe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the deep research!
| // Set up keyboard detection to resize the webview according to keyboard heights | ||
| // This fixes input fields being covered by keyboard on Samsung devices. | ||
| setupKeyboardHandling(activity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we only add this custom behavior on samsung devices?
I've found this bug report, triaged but untouched since 2023. https://issuetracker.google.com/issues/311256305. Do you think this is the source of the issue? If it is, let's add a comment to keep an eye on it.
It's not specific to Samsung, so perhaps it's wiser to add the fix to all devices 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix will apply to all devices! But I don't think setDecorFitsSystemWindows issue relates to this bug as we don't use setDecorFitsSystemWindows in these views. We do, however, use setDecorFitsSystemWindows in the Onboarding component which is a full screen dialog component - which makes this a non-issue for that component. IIUC we can't convert the Payments & Payout components into a dialog type of component since it is meant to be inline with other UI from the user
Summary
On Samsung Galaxy devices (S23, S25), input fields in popovers get covered by the soft keyboard when using embedded component views (e.g., PaymentsView). This works correctly on Pixel devices and in DialogFragment-based components (e.g., AccountOnboardingController).
Suspected cause
The web layer uses a ResizeObserver on the container div to detect size changes and reposition popovers. On Pixel devices, the WebView content area resizes when the keyboard appears, triggering the ResizeObserver. On Samsung devices, we observed that the WebView content area does not resize when the keyboard appears, so the ResizeObserver never fires and the popover stays in its original position (now covered by keyboard). This seems to be a semi-common issue unique to Samsung + webviews.
Fix
Manually detect keyboard height + visibility and resize the WebView's
layoutParams.height. Explicit height change forces the WebView to resize --> causes the container div to resize --> triggers ResizeObserver, which repositions popovers correctlyMotivation
Reported bug on Samsung Galaxy devices
Testing
Manually verified; bc the behavior is so specific to Samsung devices and keyboard, it did not seem super unit testable
Screenshots
Before
reproBeforeSamsungFix.mov
After
AndroidFixedBug.mov
Changelog