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

Abierto Apto para principiantes
#4,249 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
79/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, react-native, typescript
Área
mobile, testing

Línea de trabajo

Empieza en packages/capture-kit/src/snapshot/android-replacement-surface-occlusion.ts y rastrea cómo semanticPaintRect y semanticShowRect manejan las hojas que solo tienen un identificador. El issue incluye una condición propuesta y explica por qué el identificador debe seguir siendo utilizable como objetivo sin contar como área pintada. Comprueba las pruebas de snapshot u oclusión de Android, si las hay, y verifica que los botones hermanos ya no se marquen como cubiertos, mientras que la vista del identificador todavía pueda marcarse como cubierta.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
5.3k
Forks
377
Merge medio
14 h 6 min
PR fusionados (30 d)
650

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de callstack/agent-device

Todos los issues de callstack/agent-device

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.