fix: prevent composer keyboard from dismissing on open on small Android screens - #7387
fix: prevent composer keyboard from dismissing on open on small Android screens#7387OtavioStasiak wants to merge 4 commits into
Conversation
…creens
useCloseKeyboardWhenOrientationChanges read useSafeAreaFrame to detect
rotation, but under adjustResize + edge-to-edge that frame shrinks when the
soft keyboard opens. On small screens (e.g. Zebra TC21) the reduced height
drops to roughly the width, flipping the portrait check, so the hook fired
Keyboard.dismiss() immediately after the keyboard appeared — Gboard opened
and instantly closed.
Detect rotation from Dimensions.get('screen'), which reflects the physical
display and is unaffected by the keyboard, and react to genuine dimension
changes via a subscription instead of a render-time side effect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (3)
WalkthroughThe ChangesOrientation Change Detection via Dimensions API
Estimated code review effort: 2 (Simple) | ~8 minutes Merge Risk: ⚪ Minimal · up to This localized Android keyboard behavior fix is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
|
Android Build Available Rocket.Chat 4.74.0.109098 Internal App Sharing: https://play.google.com/apps/test/RQQ8k09hlnQ/ahAO29uNQAzJRzXty3AojKakQSnKrSudo0jYYKbfatN-IbDM_fe9PaioJvfTYFOGIN5IothcvOnCrd0iL4tz12IcXQ |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Proposed changes
On some small-screen Android devices (e.g. Zebra TC21, also seen on Android 11), the keyboard would open and
immediately close again the moment you tapped the message composer, making it impossible to type.
The cause was the useCloseKeyboardWhenOrientationChanges hook. It decided "portrait vs landscape" by comparing
the width and height of the safe-area frame, and dismissed the keyboard whenever that orientation flipped.
The problem: with adjustResize + edge-to-edge, that frame shrinks when the keyboard opens. On small screens
the reduced height drops close to the width, so the hook mistook the keyboard opening for a screen rotation
and called Keyboard.dismiss() right after the keyboard appeared.
This PR changes the hook to:
affected by the soft keyboard — so opening the keyboard no longer looks like a rotation.
side effect during render.
The keyboard now stays open when typing, while still dismissing correctly on a genuine device rotation.
Issue(s)
https://rocketchat.atlassian.net/browse/SUP-1055
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
Bug Fixes