fix: forward scroll options for pointer actions - #3358
Mihail Galay (GalayM) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped to forwarding an existing option through the last-mile protocol payloads and are backed by targeted regression tests covering the affected action entry points.
Pull request overview
This PR fixes a regression where ScrollMode.None was not preserved for pointer-based actions, causing offscreen targets to be scrolled into view despite the caller explicitly opting out. It forwards the Scroll option through Page-level option conversions and ensures Frame/ElementHandle protocol messages include the scroll field, with new regression tests covering Page/Frame/Locator/ElementHandle entry points and drag-and-drop.
Changes:
- Forward
ScrollfromPage*Optionsinto the correspondingFrame*Optionsconversions inPage.cs. - Include
scrollin the protocol payloads sent byFrameandElementHandlefor click/dblclick/hover/tap/check/uncheck/setChecked and drag-and-drop. - Add a dedicated
ScrollOptionsTestsregression suite and reorder a tooling helper to satisfy SA1204 member ordering.
File summaries
| File | Description |
|---|---|
| src/tools/Playwright.Tooling/DriverDownloader.cs | Moves ResolveNpmExecutable above instance members to fix SA1204 ordering without functional changes. |
| src/Playwright/Core/Page.cs | Preserves Scroll when converting Page-level action options into Frame action options. |
| src/Playwright/Core/Frame.cs | Forwards scroll to the driver in Frame action protocol messages (pointer actions + drag-and-drop). |
| src/Playwright/Core/ElementHandle.cs | Forwards scroll to the driver in ElementHandle action protocol messages (pointer actions). |
| src/Playwright.Tests/ScrollOptionsTests.cs | Adds regression coverage validating ScrollMode.None vs Auto/omitted across API entry points, nested/document scrolling, and drag-and-drop. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ScrollMode.Nonecurrently scrolls offscreen targets into view because the option is lost before reaching the driver. Forward it through Page's option conversions and the Frame/ElementHandle messages for click, double-click, hover, tap, checkbox actions and drag-and-drop.Adds browser regression coverage for all four API entry points, document and nested scrolling, visible targets,
None/Auto/omitted values, and non-forced click retries.Validated all 211 regression cases on Chromium, Firefox and WebKit. The full CI browser/platform matrix passes. The related Chromium suites on net10.0 pass 304 tests, with 2 existing upstream skips.
dotnet build ./srcanddotnet format ./src/ --verify-no-changes -v:diagpass.A separate prerequisite commit moves
ResolveNpmExecutablebefore instance methods without changing its body. This fixes the existing SA1204 formatting failure on the base branch.Fixes #3357