Skip to content

fix: keep maps as single tab focus targets - #935

Merged
dkhawk merged 4 commits into
googlemaps:mainfrom
himu-gupta:fix/googlemap-tab-focus
Jun 29, 2026
Merged

fix: keep maps as single tab focus targets#935
dkhawk merged 4 commits into
googlemaps:mainfrom
himu-gupta:fix/googlemap-tab-focus

Conversation

@himu-gupta

Copy link
Copy Markdown
Contributor

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:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Keep the embedded MapView as the first keyboard focus target for the map so forward Tab navigation treats each GoogleMap as 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:lintDebug

Fixes #791 🦕

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
dkhawk requested a review from kikoso June 26, 2026 00:11
dkhawk added 2 commits June 29, 2026 16:53
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
dkhawk merged commit 2f5b340 into googlemaps:main Jun 29, 2026
8 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard navigation: pressing TAB (Next focusable item) while GoogleMaps is focused skips the next focusable element

2 participants