When using TalkBack, markers inside the BottomSheetScaffold content steal focus even when the sheet content is covering the map.
Thanks for stopping by to let us know something could be better!
PLEASE READ
If you have a support contract with Google, please create an issue in the support console. This will ensure a timely response.
Discover additional support services for the Google Maps Platform, including developer communities, technical guidance, and expert support at the Google Maps Platform support resources page.
If your bug or feature request is not related to this particular library, please visit the Google Maps Platform issue trackers.
Check for answers on StackOverflow with the google-maps tag.
Please be sure to include as much information as possible:
Environment details
- com.google.maps.android:maps-compose:5.0.3
- Any Android API
Steps to reproduce
- Setup
BottomSheetScaffold - Add a map with markers as
content - Add any composable as
sheetContent - Enable talkback
- Markers can be focused event when the
sheetContentis covering the map
Code example
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ScaffoldMap() {
BottomSheetScaffold(
sheetContent = { SheetContent() }
) { padding ->
MapContent(padding)
}
}
@Composable
fun MapContent(padding: PaddingValues) {
val singapore = LatLng(1.35, 103.87)
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(singapore, 12f)
}
GoogleMap(
modifier = Modifier.fillMaxSize().padding(padding),
cameraPositionState = cameraPositionState
) {
for (i in 1..50) {
Marker(
state = rememberMarkerState(position = LatLng(1.35 + i * 0.001, 103.87 + i * 0.001)),
title = "Marker $i"
)
}
}
}
@Composable
fun SheetContent() {
LazyColumn {
items(100) { index ->
Button(
onClick = { },
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
) {
Text(text = "Button $index")
}
}
}
}
Video
https://github.com/user-attachments/assets/5bfc32b5-9465-45b8-9cb3-b7b2a1888b59
Hi @MaCls98 ,
This does seem to be an specific issue when using a BottomSheetScaffold, not something exclusively related to android-maps-compose. You can verify that by changing the background UI.
What about setting the visibility of the components manually depending on whether the sheet is visible or not?
Also, support (and lack of it) was added on this PR, maybe you can deactivate the map if the sheet is visible.
Hello @kikoso
I tried to update mergeDescendants dynamically, but the map takes the first value that is passed to the composable, when mergeDescendants is false, the focus works as expected, but the map isn't accessible with talkback
Also, I tried to replicate the same behavior, replacing the map with buttons, and in that case, the focus worked as expected.