fix(computer): align default scroll distance with web (~70% of screen)#2527
Open
quanru wants to merge 1 commit into
Open
fix(computer): align default scroll distance with web (~70% of screen)#2527quanru wants to merge 1 commit into
quanru wants to merge 1 commit into
Conversation
Deploying midscene with
|
| Latest commit: |
33cc422
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://38d0e559.midscene.pages.dev |
| Branch Preview URL: | https://fix-computer-scroll-default.midscene.pages.dev |
ottomao
approved these changes
May 25, 2026
Previously the desktop computer device used a hardcoded 500 px (libnut / AppleScript) and 480 px (RDP) as the default scroll distance when the model did not provide one. On 1080p / 1440p screens this only moves the viewport by a tiny fraction, so requests like "scroll down" effectively appear stuck and the model has to retry many times. Web puppeteer and the chrome-extension have long defaulted to `innerHeight * 0.7` / `innerWidth * 0.7`, giving roughly one screen of movement per single scroll action. This change brings the desktop backends in line: - libnut / AppleScript (Win / Linux / Mac): default distance is now `screen.height * 0.7` for vertical and `screen.width * 0.7` for horizontal scrolls. The mac AppleScript fallback also uses the real screen height when computing PageDown / PageUp count instead of the hardcoded 600 px approximation. - RDP: default distance is computed from `connectionInfo.size` using the same 0.7 ratio, with a 480 px fallback if the connection info is not yet available. The edge-scroll step amount is left unchanged since it is the per-tick wheel amount, not a "one screen" semantic. Users can still pass an explicit `distance` to override the default. The shared scroll schema is unchanged.
ed335ab to
33cc422
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
distance.innerHeight * 0.7(andinnerWidth * 0.7for horizontal). This PR brings the desktop backends into the same convention so the default behavior is consistent across web, mobile, and desktop.Changes
libnut / AppleScript (Windows / Linux / macOS) —
packages/computer/src/device.tsscreen.height * 0.7for vertical scrolls andscreen.width * 0.7for horizontal scrolls.PageUp/PageDownfallback now uses the real screen height instead of the hardcodedAPPROX_VIEWPORT_HEIGHT_PX = 600approximation when computing how many page-key presses are needed.APPROX_VIEWPORT_HEIGHT_PXconstant; introducedDEFAULT_SCROLL_VIEWPORT_RATIO = 0.7.RDP —
packages/computer/src/rdp/device.tsconnectionInfo.sizeusing the same0.7ratio (per axis).480ifconnectionInfois not available yet.scrollToTop/scrollToBottom/ etc.) is intentionally left at480because it is the per-tick wheel amount, not a "one screen" semantic.The shared
actionScrollParamSchema(in@midscene/core) is not changed — this PR only affects what happens when the model does not pass adistance. Callers can still override with an explicit value.User-visible effect
Before, on Windows / Linux:
After:
The Kylin Linux target that's coming next inherits the same behavior automatically (single shared core).
Test plan
npx nx test computer— 9 test files / 44 tests passpnpm run lint— cleandistance