Repository navigation
Commit 943913a
authored
fix(android): stop empty focusable overlays from hiding app content (#1737)
* fix(android): stop empty focusable overlays from hiding app content (#1733)
The covered-subtree pruner let any `hittable` sibling condemn a lower
drawing-order sibling it geometrically covers. `hittable` is
`clickable ?? focusable`, so a childless, textless, id-less full-screen
focusable View qualified as "agent-visible content" and dropped the
sibling holding the real UI.
Telegram wraps every screen in exactly such a View, which is why
`snapshot` returned 1 node on every Telegram screen while the helper and
stock `uiautomator dump` both saw the full tree — the loss was in the TS
parser, not the Android helper.
Key covering candidacy on `clickable` instead: focusability is an
accessibility-traversal property and says nothing about painting over a
sibling. Also generalise the existing "never condemn a marker leaf"
exemption to any childless, non-clickable sibling that carries its own
text or identifier, since drawing order plus geometry cannot distinguish
a transparent overlay from an opaque one.
* fix(android): keep descendant coverage classification on hittable
Review feedback on #1733: narrowing hasActionableDescendant from
`hittable` to `clickable` was over-reach. The helper emits
clickable/focusable only when true, so a focusable-only control parses as
clickable=undefined, hittable=true — and D-pad/TV surfaces are built
almost entirely from those. A foreground surface containing them would
have stopped qualifying as covering, leaving background selector/ref
targets retained and actionable behind it.
Descendant classification returns to the established `hittable` contract,
and the leaf exemption returns to `!hittable` so a genuinely covered
affordance stays condemned. The Telegram fix needs only to exclude the
empty focusable wrapper itself, which is self-classification in
hasOwnAgentVisibleContent — that stays on `clickable`.
Replaces the test that asserted the rejected behavior with a
helper-shaped regression: a foreground descendant carrying focusable
without any clickable attribute must still suppress a covered target.
* refactor(android): split clickable and focusable instead of collapsing them
`hittable: clickable ?? focusable` collapsed two independent Android facts
and made behavior depend on how a producer encodes a false attribute. The
snapshot helper omits `clickable`; stock UiAutomator writes
`clickable="false"`. For one focusable control those encodings gave
opposite answers — verified: identical trees pruned differently and
projected opposite `hittable` values. No comment can hold an invariant the
representation contradicts, which is what the previous two commits tried
to do.
The tree now stores `clickable` and `focusable` as separate non-optional
booleans, and every decision reads a named predicate: isTouchTarget,
isFocusTarget, isAgentTarget, hasSemanticContent, hasDirectOcclusionEvidence,
hasDescendantOcclusionEvidence, isPresentationLeaf. `canCoverSibling`
consumes one derived classification (hasOcclusionEvidence) rather than
choosing between raw attributes, so the self-versus-descendant substitution
that caused the last review round is no longer expressible. Removing
`hittable` from the tree type made the typechecker find every construction
site; the public field is derived once at projection from isAgentTarget.
Behavior change: a focusable, non-clickable control encoded by stock
UiAutomator now projects hittable=true and participates in occlusion,
matching what the helper backend already did for the same control. The
Android TV test asserted the old encoding-specific value; it now asserts
inclusion plus the unified projection. One encoding-parity regression
replaces the patch-specific test added last round.1 parent f18f8b0 commit 943913a
3 files changed
Lines changed: 176 additions & 37 deletions
File tree
- src
- __tests__/test-utils
- platforms/android
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
247 | 283 | | |
248 | 284 | | |
249 | 285 | | |
| |||
460 | 496 | | |
461 | 497 | | |
462 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
463 | 564 | | |
464 | 565 | | |
465 | 566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
425 | 429 | | |
426 | 430 | | |
427 | 431 | | |
| |||
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
| 473 | + | |
| 474 | + | |
469 | 475 | | |
470 | 476 | | |
471 | 477 | | |
| |||
492 | 498 | | |
493 | 499 | | |
494 | 500 | | |
495 | | - | |
| 501 | + | |
| 502 | + | |
496 | 503 | | |
497 | 504 | | |
498 | 505 | | |
| |||
523 | 530 | | |
524 | 531 | | |
525 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
526 | 580 | | |
527 | 581 | | |
528 | 582 | | |
| |||
554 | 608 | | |
555 | 609 | | |
556 | 610 | | |
557 | | - | |
558 | | - | |
| 611 | + | |
559 | 612 | | |
560 | 613 | | |
561 | 614 | | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | 615 | | |
568 | 616 | | |
569 | 617 | | |
| |||
595 | 643 | | |
596 | 644 | | |
597 | 645 | | |
598 | | - | |
| 646 | + | |
599 | 647 | | |
600 | 648 | | |
601 | 649 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
610 | 653 | | |
611 | 654 | | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
623 | 658 | | |
624 | 659 | | |
625 | 660 | | |
| |||
752 | 787 | | |
753 | 788 | | |
754 | 789 | | |
755 | | - | |
756 | | - | |
| 790 | + | |
757 | 791 | | |
758 | 792 | | |
759 | 793 | | |
| |||
784 | 818 | | |
785 | 819 | | |
786 | 820 | | |
787 | | - | |
| 821 | + | |
788 | 822 | | |
789 | 823 | | |
790 | 824 | | |
| |||
0 commit comments