googlemaps / googlemaps/android-maps-compose

Clustering: Missing contentDescription on the clustering pins

Aperta
#683 3 commenti 1 reazione 0 assegnatari Vedi su GitHub
priority: p1 type: bug
Lingua principale
Kotlin
Stelle
1.3k
Fork
181
Merge medio
2g 23h
PR unite (30g)
18

Descrizione

Hi,

I am missing `contentDescription` on the clustering pins.
It's an issue only for the clustering pins, as `contentDescription` works fine for the non-clustering pins.

### Environment details

1. OS type and version:
Android 15 (Google Pixel 7 Pro emulator on Windows 10)
2. Library and version:
`com.google.maps.android:maps-compose:6.4.4`
`com.google.maps.android:maps-compose-utils:6.4.4`
compose BOM `2024.10.01`

### Steps to reproduce

1. Add clustering pins through the Clustering function. I don't believe it really matters how you do this, but you can check our setup below
2. Set `contentDescription` on your clustering pins
3. Run the app and view pins on map
4. Export uiautomator xml dump
`adb shell uiautomator dump /sdcard/ui.xml`
`adb pull /sdcard/ui.xml "exported_test_tags.xml"`
5. Check the exported xml for `content-desc` values of the clustering pins

#### App screenshot for the uiautomator dump
![Image](https://github.com/user-attachments/assets/c07cb79a-fc4f-4e15-9b3f-3ebb4510284c)

#### Slice of the uiautomator dump I got for the attached screenshot (trimmed some unnecessary tags & data)
```
























```

### The missing contentDescription part
I expected to see the clustering pins with their correct `content-desc` tag value in the xml.
`content-desc="marker_generic_unselected_ChIJx0ZL3KwEdkgRbqnmC8H0RA8"`
`content-desc="marker_generic_unselected_ChIJFZCSWqYEdkgRrIou3nanh70"`

But they all have `content-desc="Map Marker"`. They are in the xml dump, but outside of the the "Google Map" view element.
This causes our automated test on Appium to break, as they can't find the pins to "click on them".
Any idea on how to fix this issue? Unfortunately the "Map Marker" value seems to be hardcoded.

I would like to see something like this, in the xml dump
```


```

### Code example
#### GoogleMaps Clustering setup
```
GoogleMap(
mergeDescendants = false // it's actually a default value, but it's important to mention this param
) {
val clusterManager = rememberClusterManager()
val renderer = rememberClusterRenderer(
clusterContent = { Cluster(it) },
clusterItemContent = { ClusterItem(it) },
clusterManager = clusterManager,
)

clusterManager?.renderer = renderer

Clustering(
items = pins.toClusterPins(),
clusterManager = clusterManager,
)
}

// We are creating renderer ourselfs so that we can use NonHierarchicalViewBasedAlgorithm algorithm for the cluster manager
```

#### Clustering pins composable
```
@Composable
fun ClusterItem(pin: ClusterPinResource) {
Image(
bitmap = pin.icon,
contentDescription = pin.testTag,
)
}
```

#### Also tried this composable
```
@Composable
fun ClusterItem(pin: ClusterPinResource) {
Box(
modifier = Modifier
.wrapContentSize()
.semantics { contentDescription = pin.testTag }
.testTag(pin.testTag)
) { /* some content */ }
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con il composable Clustering e il percorso personalizzato rememberClusterRenderer mostrati nell’issue, quindi riproduci il problema con i comandi uiautomator dump forniti. Traccia il modo in cui la semantica di ClusterItem raggiunge la gerarchia della mappa e confrontala con quella dei pin senza clustering. Il lavoro è completato quando i pin con clustering espongono la contentDescription fornita nella gerarchia di accessibilità della mappa, così che Appium possa individuarli e fare clic su di essi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, kotlin
Ambito
accessibility, mobile, testing-qa
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.