fix: guard against bogus measureInWindow values#3739
Merged
Conversation
szuperaz
approved these changes
Jul 22, 2026
Contributor
SDK Size
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Fixes an issue where in certain scenarios on Android,
measureInWindowwould produce extremely out of bouds values for itsxandycoordinates, causing the contextual menu to not display any content as it's about 30 screens offset.Should also close this Zendesk issue.
This reproduces whenever the app is made edge-to-edge by a library (i.e
react-native-system-navigation-bar'ssetNavigationColor('transparent'), which setsFLAG_LAYOUT_NO_LIMITS) while React Native's own edge-to-edge is explicitly not enabled (edgeToEdgeEnabled=false). In that state Android'smeasureInWindowreturns wildly out of bounds coordinates, so the overlay which positions its teleported hosts at the absolute measured rect lands ~tens of screens offscreen. Only the position independentabsoluteFillbackdrop stays visible.🛠 Implementation details
measureInWindownow sanity checks the measured rect. If it's non finite, zero sized or lands more than2×the screen bounds away (the failure mode is off by ~33×, valid on screen targets are always< 1×so this was an acceptable buffer zone to me), it falls back tomeasure()and uses the root relativepageX/pageY.absoluteFillinsideOverlayProvider) and it stays correct because the React root's layout is RN owned, unlike the OS window, whose frame the library mutates behind RN's backmeasureInWindow+ Androidinsets.topcompensation is unchanged, andmeasure().pageYequals it exactly in every healthy config, so a (rare) false positive is a noopPortalWhileClosingViewnow shares the same util, so the close animation teleport (composer/header staying above the closing message) gets the identical protection instead of its previous duplicated inline measurementFor integrators, the first class fix remains enabling RN's
edgeToEdgeEnabled=trueas this change is only a workaround that makes the SDK resilient even when they haven't.🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
developbranch