Android: an identifier-only leaf paints its sibling layer over the whole screen, marking everything covered

Aperta Adatta ai principianti
#4,249 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
79/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, react-native, typescript
Ambito
mobile, testing

Direzione di ricerca

Inizia da packages/capture-kit/src/snapshot/android-replacement-surface-occlusion.ts e segui come semanticPaintRect e semanticShowRect gestiscono le foglie che contengono solo un identificatore. L’issue include una condizione proposta e spiega perché l’identificatore dovrebbe restare utilizzabile come destinazione senza essere conteggiato come area disegnata. Controlla i test di snapshot o di occlusione Android, se presenti, e verifica che i pulsanti fratelli non vengano più contrassegnati come coperti, mentre la vista dell’identificatore possa ancora essere contrassegnata come coperta.

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

Descrizione

Version: 0.21.36 (the same code is on main at packages/capture-kit/src/snapshot/android-replacement-surface-occlusion.ts)
Platform: Android (emulator, android-36), React Native app

What happens

On Android every element on our chat screen comes back interactionBlocked: "covered", so locator taps refuse with "Ref @e88 is covered by another visible element and cannot be tapped safely". The screen itself is fine: a coordinate click on the same button opens it.

Why

The screen is a React Native stack of full-screen sibling layers under one parent: background, message list, header buttons, composer. The composer layer is

#117 ViewGroup            (0,0,1080,2150)  not hittable
  #119 ViewGroup id=coach-container (0,0,1080,2150)  leaf, not hittable, no label/value
  #120 ... composer buttons (hittable)

coach-container is a <View testID pointerEvents="box-none" style={absoluteFill}>: transparent, no handlers, and it has only an identifier. In semanticPaintRect the clause childCount === 0 && hasSemanticContent(node) counts it as painting its whole rect, because hasSemanticContent accepts identifier. Its layer has an action (the composer buttons), so the layer's paint footprint covers 100% of every earlier sibling, and the header buttons and every message bubble get marked covered.

Suggested fix

Don't let an identifier-only leaf paint. An identifier is a test hook, not something drawn, and a non-hittable leaf with no label or value carries no evidence that it's opaque or catches touches:

function semanticPaintRect(node: RawSnapshotNode, childCount: number): Rect | undefined {
  if (!isPositiveFiniteRect(node.rect)) return undefined;
  return node.hittable === true ||
    isScrollableType(node.type) ||
    (childCount === 0 && Boolean(node.label?.trim() || node.value?.trim()))
    ? node.rect
    : undefined;
}

semanticShowRect keeps hasSemanticContent, so such a view can still be the target that gets covered. We're carrying this as a pnpm patch on 0.21.36 for now. I'll comment here with the result once our Android coach flows have run with it.

Lingua principale
TypeScript
Stelle
5.3k
Fork
377
Merge medio
14h 6m
PR unite (30g)
650

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstack/agent-device

Tutte le issue di callstack/agent-device

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.