fix: keep maps as single tab focus targets - #935
Merged
Conversation
This ensures that the Compose focus system can successfully target the AndroidView wrapper, allowing focus traversal (TAB) to work correctly and resolving test failures. TAG=agy CONV=c8ea8596-9a4a-488b-885a-df4f8d27c209
dkhawk
approved these changes
Jun 26, 2026
Adds inline comments explaining the Compose and View-level focus configuration on GoogleMap, and KDoc to the focus traversal test class. TAG=agy CONV=c8ea8596-9a4a-488b-885a-df4f8d27c209
dkhawk
pushed a commit
that referenced
this pull request
Jul 14, 2026
* feat: allow GoogleMap to opt out of keyboard focus traversal Adds a focusable parameter to GoogleMap (default true, preserving the single-tab-stop behavior introduced in #935). When false, the map and its internal controls are removed from keyboard focus traversal, e.g. for maps used as decorative backgrounds behind other focusable content. Fixes #938 * test: don't wait for map load in focus traversal test Focus traversal only requires the composed view hierarchy, not loaded map tiles; waiting on onMapLoaded made the test flaky on CI emulators. Wait for the map's semantics node instead, matching the existing traversal test. * test: use focusable boxes instead of Buttons in traversal test Material Buttons are clickable-based and only accept focus in keyboard mode; requestFocus on them fails in the touch-mode test environment. Plain Modifier.focusable() elements accept focus in both modes, same as the map itself.
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.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Keep the embedded
MapViewas the first keyboard focus target for the map so forward Tab navigation treats eachGoogleMapas one focus stop before moving to the next Compose item.Tests:
./gradlew :maps-compose:compileDebugKotlin :maps-app:compileDebugAndroidTestKotlin./gradlew :maps-app:assembleDebug./gradlew :maps-compose:lintDebug :maps-app:lintDebug./gradlew :maps-app:lintDebugFixes #791 🦕