Skip to content

fix: no invented colours for elements too small to sample - #19

Merged
woladi merged 1 commit into
mainfrom
fix/tiny-element-colors
Aug 24, 2026
Merged

woladi merged 1 commit into
mainfrom
fix/tiny-element-colors

Conversation

@woladi

@woladi woladi commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Found while verifying uiSnapshot on an unlocked screen.

A 1×1 pt element has no interior left once the edge inset is applied, so its "fill" was sampled from outside it. Every screen-reader anchor in a real page — "Skip to content", hidden headings — came back solid black:

Link    [-1,146,1,1]   {"bg":"#000000","border":"#F0F0F0"}  "Skip to content"
Heading [336,262,1,1]  {"bg":"#000000","border":"#F0F0F0"}  "Editing README.md in…"

Seven such nodes in a 439-node Safari window. To a consumer that reads as a black element that is not there.

Sampling now needs a box with a real interior, and the inset can no longer exceed the box. Elements thin in one dimension only — a 5 pt split handle, a scrollbar — keep their colours, and 431 of 439 nodes still carry style, so nothing was over-suppressed.

106 tests, including a guard that no sub-3pt element carries a style and that the majority of nodes still do.

🤖 Generated with Claude Code

A 1x1pt element — the screen-reader anchors real pages are full of,
"Skip to content" and the like — has no interior left once the edge inset
is applied, so its fill was sampled from outside it and came back solid
black. Seven such nodes in a 439-node Safari window all reported
bg: #000000, which reads as a black element that is not there.

Sampling now requires a box with a real interior, and the inset can no
longer exceed the box. Elements thin in one dimension only, like a 5pt
split handle, keep their colours: 431 of 439 nodes still carry style.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@woladi
woladi merged commit 1d5a994 into main Aug 24, 2026
1 check passed
@woladi
woladi deleted the fix/tiny-element-colors branch August 24, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant