oficina / docs Public

i2.mjs: probe the band where a picker's list leaves the inspector

The probe sampled the list's corners, which can sit inside the panel or
past the window's foot (a 240px list in a 300px window, once in the full
suite); it now samples the middle of the band where the list hangs
outside the panel, inside the window. Still red with the blur back on
the panel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev aeb9c0ac7000679fcad8a3a0fa1b8476762aebc3 parent ac1393c
1 file changed, +7 −7
  • fixtures/engines/i2.mjs +7 −7

CI passed — run details

diff --git a/fixtures/engines/i2.mjs b/fixtures/engines/i2.mjs
index f2020d5..71b787f 100644
--- a/fixtures/engines/i2.mjs
+++ b/fixtures/engines/i2.mjs
@@ -263,13 +263,13 @@ for (const engine of [chromium, webkit]) {
const list = document.querySelector('[docs-inspector] [rst-combo]:has(#docs-select-font-combo) [rst-combo-list]')
const box = document.querySelector('[docs-inspector]').getBoundingClientRect()
const r = list.getBoundingClientRect()
- // A point of the list outside the inspector's box, if it has one.
- const ys = [r.bottom - 4, r.top + 4]
- const xs = [r.right - 4, r.left + 4]
- let outside = null
- for (const y of ys) for (const x of xs) {
- if ((y > box.bottom || y < box.top || x > box.right || x < box.left) && x >= 0 && y >= 0 && x < innerWidth && y < innerHeight) outside = outside || { x, y }
- }
+ // A point of the list outside the inspector's box and inside the
+ // window, if it has one: the middle of the band where it hangs
+ // below the box (or above it), at the list's centre line.
+ const x = Math.min(innerWidth - 1, Math.max(0, (r.left + r.right) / 2))
+ const below = [box.bottom, Math.min(r.bottom, innerHeight)]
+ const above = [Math.max(r.top, 0), box.top]
+ const outside = below[1] - below[0] > 2 ? { x, y: (below[0] + below[1]) / 2 } : above[1] - above[0] > 2 ? { x, y: (above[0] + above[1]) / 2 } : null
const hit = outside && document.elementFromPoint(outside.x, outside.y)
return { list: { t: r.top, b: r.bottom, l: r.left, r: r.right, h: r.height }, box: { t: box.top, b: box.bottom, l: box.left, r: box.right }, outside, inList: !!(hit && list.contains(hit)), position: getComputedStyle(list).position }
})