mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-10-18 23:07:13 -05:00
* fix(humanize): scroll the x axis in scroll-into-view (#521) humanScrollIntoView only measured and scrolled the y axis. A target past the right edge of a horizontally overflowing page counted as in view, so no wheel events were sent, the click point landed offscreen and the pointer check failed with "element is covered by <none>" after the full timeout. After the vertical pass, a horizontal pass now checks that the box fits inside the viewport width and, if not, centres it with the same humanized wheel burst on the x axis. It skips the scroll when the page is already pinned at the needed horizontal boundary, mirroring the y pinned check. Applied to Python (sync and async), JS Playwright, Puppeteer and .NET. .NET: IRawScrollPage.GetScrollStateAsync now also returns X and MaxX. Fixes #521 * fix(humanize): handle RTL scrollX in the horizontal pinned check (#521) In right-to-left documents Chrome's window.scrollX runs from 0 down to -(scrollWidth - clientWidth). The x pass treated "scrollX <= 0" as pinned at the left edge, so on an RTL page at its start a target in the left overflow was never scrolled into view and the click failed with "covered by <none>". The scroll-state script now also reads the viewport direction (taken from <body> when present, as Chrome does) and returns an RTL-aware minX and maxX. Python, JS Playwright and .NET compare against those. The .NET adapter shifts X and MaxX by minX so IRawScrollPage keeps its tuple shape and X still runs 0..MaxX. Puppeteer has no pinned check on the x axis and is unchanged. * fix(humanize): skip the x pass for sub-pixel distances A box wider than the viewport never passes the containment check, so every action on it ran the x pass even when it was already centred: a mouse move to the scroll area and a 0 or 1px wheel. Skip the pass when the distance to centre is under 1px. Applied to Python (sync and async), JS Playwright, Puppeteer and .NET. * test(humanize): reword the set_content note on the #521 browser tests The comment stated as fact that set_content never settles in CloakBrowser. What I observed is narrower: it timed out in local runs of these tests, so say that instead.