Skip to content

feat(theory): touch container vs visible glyph for tap-target check#3

Closed
viktor-savchik-idf wants to merge 2 commits into
mainfrom
feat/hit-area-and-tautology
Closed

feat(theory): touch container vs visible glyph for tap-target check#3
viktor-savchik-idf wants to merge 2 commits into
mainfrom
feat/hit-area-and-tautology

Conversation

@viktor-savchik-idf

@viktor-savchik-idf viktor-savchik-idf commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

fitts_undersized_target was firing on every Material IconButton whose visible icon was below 48dp — but the 48dp minimum applies to the invisible touch container, not the glyph inside it. The check now uses optional hit_w / hit_h fields when declared, and downgrades to MEDIUM "verify in code" when only the visible bbox is known.

Refactoring landed in the same feat commit: _check_tap_target is split out of _check_fitts so each function does one thing. Side benefit — the tap-target check now fires for a single interactive element (Fitts's len(interactive) < 2 early-return was silently skipping it). Public check names are unchanged.

SKILL.md gains two documentation sections:

  • Optical Alignment — why asymmetric icons (pencil, arrow, play, magnifier) have visual centres offset from their geometric centres, with references to Apple HIG SF Symbols, Material Iconography, and Müller-Brockmann. Explains why automated optical-centre checking is intentionally out of scope (high false-positive rate without per-icon optical-grid metadata).
  • Icon + label tautology as an inline rule the model applies during reviews. A pictogram paired with the bare action verb it already encodes is a polish failure. Deliberately a model-applied rule rather than a code check; automated detection would need a per-locale vocabulary that is expensive to maintain and produces only LOW-severity findings.

Commits

  • feat(theory): feature + refactor + SKILL.md + CHANGELOG + 6 unit tests.
  • test(theory): checked-in fixture tools/tests/fixtures/confirm_screen_with_iconbutton.json + smoke test asserting exact (check, element, severity) tuples.

Schema changes (optional, backward-compatible)

Field Purpose
hit_w / hit_h Touch container size when larger than visible bounds

Severity matrix for fitts_undersized_target

hit_w/hit_h declared? Touch side < min? Severity Wording
Yes Yes HIGH "touch container of Xdp, below minimum"
Yes No silent (correctly passes)
No Yes MEDIUM "verify the touch container is >=48dp"
No No silent (passes on visible bounds alone)

Tests

  • 7 new tests (5 hit-area + 1 single-element tap-target regression guard + 1 fixture smoke).
  • 30/30 theory tests pass.
  • Full suite: 271/271 (excluding pre-existing test_mcp.py asyncio-fixture failures on origin/main).

Smoke test (end-to-end, from the checked-in fixture)

$ lumo-theory check --layout tools/tests/fixtures/confirm_screen_with_iconbutton.json
FOUND  1 finding (1 medium)
  1. [MEDIUM] fitts_undersized_target  — info_icon_bare_no_hit_area (16dp, no hit declared)

Correctly silent on back_arrow_material_iconbutton (24dp glyph wrapped in a 48dp IconButton via declared hit_w/hit_h) — the false positive that motivated the PR.

@viktor-savchik-idf viktor-savchik-idf added the enhancement New feature or request label Jun 3, 2026
@viktor-savchik-idf viktor-savchik-idf self-assigned this Jun 3, 2026
@viktor-savchik-idf viktor-savchik-idf force-pushed the feat/hit-area-and-tautology branch from bf9fe6c to 67ed397 Compare June 3, 2026 17:46
fitts_undersized_target now distinguishes the touch CONTAINER from the
visible glyph. Element schema gains optional hit_w / hit_h fields: when
declared and below the platform minimum the finding fires at HIGH (real
defect); when only the visible bbox is known the finding still fires
but at MEDIUM worded as "verify the touch container in code" — Compose
IconButton and SwiftUI Button already wrap their content in a compliant
hit area by default, so a small visible glyph is not automatically a
defect. Eliminates a class of false positives that triggered on every
Material IconButton with a 24dp glyph.

Refactored: _check_tap_target is split out of _check_fitts so each
function does one thing. Side benefit — the tap-target check now fires
for a single interactive element (Fitts's "need ≥2 targets" early-
return was silently skipping it). Public check names are unchanged.

SKILL.md gains an Optical Alignment section documenting why asymmetric
icons (pencil, arrow, play, magnifier) have visual centres offset from
geometric centres, with references to Apple HIG SF Symbols, Material
Iconography, and Müller-Brockmann — and why automated optical-centre
checking is intentionally out of scope (high false-positive rate
without per-icon optical-grid metadata).

Also adds an "Icon + label tautology" inline rule that the model
applies during reviews — a pictogram paired with the bare action verb
it already encodes is a polish failure. Deliberately a model-applied
rule rather than a code check; automated detection would need a per-
locale vocabulary that is expensive to maintain and produces only
LOW-severity findings.

The Touch Targets section is clarified: the 48dp / 44pt minimum is
for the touch container, not the visible glyph.

6 new unit tests (5 hit-area + 1 regression guard for single-element
tap-target).
Adds tools/tests/fixtures/confirm_screen_with_iconbutton.json — a
generic mobile confirmation screen exercising the three tap-target
patterns the feat commit introduces:
  - Material IconButton (24dp glyph + 48dp hit area declared) — silent.
  - Bare undersized icon without hit_w/hit_h — MEDIUM "verify in code".
  - Full-width primary CTA at the bottom — silent.

The accompanying smoke test asserts the exact (check, element, severity)
tuples so anyone reviewing the PR can replay end-to-end behaviour
deterministically.
@viktor-savchik-idf viktor-savchik-idf force-pushed the feat/hit-area-and-tautology branch from 67ed397 to f103bbc Compare June 3, 2026 20:22
@viktor-savchik-idf viktor-savchik-idf changed the title feat(theory): touch container vs visible glyph + icon_label_tautology feat(theory): touch container vs visible glyph for tap-target check Jun 3, 2026
@OneXeor

OneXeor commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Closing in favor of #4, which combines and rewrites this work as one OSS-ready PR with project-specific language removed.

@OneXeor OneXeor closed this Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants