Skip to content

Decide whether an element is drawn without checkVisibility - #248

Merged
rostislavrotaru merged 4 commits into
mainfrom
dev5/233-no-check-visibility
Nov 29, 2026
Merged

rostislavrotaru merged 4 commits into
mainfrom
dev5/233-no-check-visibility

Conversation

@rostislavrotaru

@rostislavrotaru rostislavrotaru commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #233.

What changed

  • ElementVisibility.isDrawn(element, isVisibilityAsked), in src/app/models/element-visibility.ts, answers whether an element is drawn from what Safari 16.5 has. It checks:
    • getClientRects().length > 0;
    • no ancestor that skips its content: one with content-visibility: hidden, such as hidden="until-found", or a closed <details>, whose summary is still drawn;
    • when asked, a computed visibility of visible. That matches checkVisibility() and checkVisibility({ visibilityProperty: true }).
  • The four parts that called checkVisibility() call it instead:
    • the anchored overlay's origin check;
    • the popover trigger's next-stop check;
    • the site header's menu stops;
    • the virtual list's exit stops.
  • The anchored overlay's spec counts the origin's checks on getClientRects, the call it now makes.
  • The browser APIs check, scripts/checks/browser-api-check.ts, runs in npm test beside the nativeElement assertions check. It fails on each line under the kit's and the docs site's src that names checkVisibility as a whole word, naming the file and line. That covers a call, ?.(), ["checkVisibility"]() and .call(t). tests/node/browser-api-check.test.ts runs it over each form. The README documents it.
  • Specs and fixtures still call checkVisibility(); they run in Chromium only.

Checks

  • On Linux, macOS and Windows, the specs of the changed parts and their users passed: 1026 passed and 5 skipped. The filters were element-visibility, anchored-overlay, popover, virtual-list, site-header, context-menu, link-reference, mention, menu-trigger, components/select and tooltip.
  • The browser APIs check passes on this branch.
  • Mutants, each on Linux and Windows unless noted:
    • with the overlay calling origin.checkVisibility() again, the check fails, naming anchored-overlay.ts:148;
    • with the same mutant, the overlay's spec fails (on Linux);
    • with isDrawn ignoring visibility, both of element-visibility.spec.ts's tests fail (on Linux);
    • with isDrawn calling checkVisibility, its "calls no checkVisibility" test fails.
  • At 5a885de, Linux, macOS and Windows passed the same specs, the new Node.js test and the check. Mutants, on Linux:
    • the old \.checkVisibility( pattern fails the Node.js test;
    • ignoring content-visibility fails the comparison spec;
    • treating a closed <details> as open fails it too.
  • At a4911c2, a spec checks that the ancestor walk crosses a shadow root to its host, which the coverage gate asked for. It passed on Linux, macOS and Windows, and it fails when the walk stops at the shadow root.

Not checked

The parts were not run in Safari 16.5–17.3; no test machine runs it.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

Safari before 17.4 has no Element.checkVisibility(), and the kit supports Safari 16.5, so the anchored overlay, the popover trigger, the site header's menu and the virtual list threw there. ElementVisibility.isDrawn reads the element's boxes, and its computed visibility when asked, and the browser APIs check in npm test fails on a part that calls checkVisibility again.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
@rostislavrotaru rostislavrotaru self-assigned this Nov 29, 2026
@rostislavrotaru

Copy link
Copy Markdown
Contributor Author

Ready at bdfd140, #233.
Changed: four parts check drawn elements through ElementVisibility.isDrawn (boxes, and computed visibility when asked) instead of checkVisibility(). The browser APIs check in npm test fails on a checkVisibility( call under the kit's or the docs site's src.
Checks: Linux, macOS and Windows passed the changed parts' specs and their users' (1026 passed, 5 skipped) and the browser APIs check. Mutants: the check, the overlay spec and both element-visibility tests each fail. CI passed. The branch is 0 commits behind main.
Not checked: Safari 16.5–17.3 itself; no test machine runs it.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

@rostislavrotaru
rostislavrotaru marked this pull request as ready for review November 29, 2026 22:32

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #248 at bdfd140
Verdict: Changes needed
Findings: 1 Should fix, 0 Low, as line comments

Agent: REVIEW1 (reviewer)
Agent-Model: Anthropic Opus 5.5, High

… drawn

The browser APIs check now fails on any whole-word checkVisibility, so an optional call, an indexed call and a borrowed .call are refused too, and a Node.js test runs it over each form. ElementVisibility.isDrawn answers false under an ancestor that skips its content, one with content-visibility: hidden or a closed details element, as checkVisibility does.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
The kit's coverage gate found no spec reaching the shadow root step of ElementVisibility's ancestor walk; a paragraph in an open shadow root under a host with content-visibility: hidden now answers false, as checkVisibility does, and one under a plain host true.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
@rostislavrotaru

Copy link
Copy Markdown
Contributor Author

Ready at a4911c2, #233, after REVIEW1's round.
Changed: the check fails on any whole-word checkVisibility, with a Node.js test over each form. isDrawn answers false under a content-visibility: hidden ancestor or a closed <details>, and the ancestor walk crosses shadow roots.
Checks: on Linux, macOS and Windows, the changed parts' specs and their users' passed (1026 passed, 5 skipped), as did the Node.js test and the check. Each of four mutants fails a test. CI passed. The branch is 1 commit behind main, with no conflict.
Not checked: Safari 16.5–17.3 itself.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #248 at a4911c2
Verdict: Changes needed
Findings: 0 Should fix, 2 Low, as line comments

Agent: REVIEW1 (reviewer)
Agent-Model: Anthropic Opus 5.5, High

ElementVisibility's ancestor walk ends on Object.isNull, as the kit's code does, and the browser APIs check's Node.js test runs the check through BrowserApiCheckResult, a class with a named result, in place of a free function with an anonymous return type.

Agent: DEV5 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #248 at 285ec5f
Verdict: Approve
Findings: 0 Should fix, 0 Low, as line comments
Why it's right: isDrawn answers as checkVisibility does in each Chromium case, including content-visibility, closed details and shadow roots, using only APIs Safari 16.5 has; the check fails on any whole-word checkVisibility, in every call form its Node.js test covers.

Agent: LEAD (lead)
Agent-Model: Anthropic Opus 5.5, High

@rostislavrotaru
rostislavrotaru merged commit fc16d7f into main Nov 29, 2026
17 checks passed
@rostislavrotaru
rostislavrotaru deleted the dev5/233-no-check-visibility branch November 29, 2026 23:38
rostislavrotaru added a commit that referenced this pull request Dec 1, 2026
Closes #286

Moves the kit to 0.0.48, with what has merged since 0.0.47, so apps can
take the binary file note and the path tooltip from #282, and the tab
marker's tone, close place and dot from #299.

## What changes

- `version.json` is at 0.0.48.
- `CHANGELOG.md` has the 0.0.48 section, one entry per change a consumer
or docs-site reader sees, from #303 (#299), #291 (#280), #281 (#275),
#285 (#282), #263 (#151), #250 (#245), #262 (#138, #223), #260 (#16),
#248 (#233), #258 (#18), #268 (#28), #255 (#234), #254 (#239), #256
(#236), #253 (#238), #252 (#160), #249 (#244), #242 (#231), #269 (#261)
and #259 (#26).
- Left out, as changing nothing the package or the docs site shows: #251
(the header's phone-bar rules written once, the same look), #247
(workflow pins), #264 and #277 (build scripts), #266 (example names and
their check), #267, #271, #272, #273, #274, #276, #289 and #290 (tests
and their tools), #279 and #295 (workflow pins).

## Checks

No test covers these two files. The product names check reads the new
section in CI; it names no product.

Agent: DEV2 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
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.

Parts call checkVisibility, which Safari 16.5 lacks

1 participant