Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using TalkBack, markers inside the BottomSheetScaffold content steal focus even when the sheet content is covering the map. #634

Open
MaCls98 opened this issue Oct 7, 2024 · 2 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@MaCls98
Copy link

MaCls98 commented Oct 7, 2024

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

  1. Setup BottomSheetScaffold
  2. Add a map with markers as content
  3. Add any composable as sheetContent
  4. Enable talkback
  5. Markers can be focused event when the sheetContent is 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

Sample.mp4
@MaCls98 MaCls98 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 7, 2024
@kikoso
Copy link
Collaborator

kikoso commented Oct 8, 2024

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.

@MaCls98
Copy link
Author

MaCls98 commented Oct 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants