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

Aberta Para iniciantes
#4,249 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
79/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
android, react-native, typescript
Domínio
mobile, testing

Direção de pesquisa

Comece em packages/capture-kit/src/snapshot/android-replacement-surface-occlusion.ts e acompanhe como semanticPaintRect e semanticShowRect lidam com folhas que contêm apenas um identificador. A issue inclui uma condição proposta e explica por que o identificador deve continuar utilizável como alvo sem contar como área pintada. Verifique os testes de snapshot ou de oclusão do Android, se houver, e confirme que os botões irmãos não são mais marcados como cobertos, enquanto a visualização do identificador ainda pode ser marcada como coberta.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
5.3k
Forks
377
Merge médio
14h 6min
PRs com merge (30d)
650

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de callstack/agent-device

Todas as issues de callstack/agent-device

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.