Skip to content

Conversation

@bvandercar-vt
Copy link
Contributor

No description provided.

@Niek Niek requested a review from Copilot March 5, 2025 15:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR adds a new scrollTo functionality to the GhostCursor and updates documentation accordingly.

  • Added documentation for the scrollTo function in README.md.
  • Extended the GhostCursor interface and implemented the scrollTo function in src/spoof.ts.
  • Introduced a new ScrollToOptions interface.

Reviewed Changes

File Description
README.md Added documentation for the new scrollTo function
src/spoof.ts Added ScrollToOptions interface, updated GhostCursor interface, and implemented scrollTo

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

src/spoof.ts Outdated
: { top: destination.y, left: destination.x }

window.scrollTo({
behavior: optionsResolved.behavior ?? (defaultOptions?.scrollIntoView?.scrollSpeed !== undefined &&
Copy link

Copilot AI Mar 5, 2025

Choose a reason for hiding this comment

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

The page.evaluate callback references 'optionsResolved' and 'defaultOptions' which are not passed into its scope; this may lead to undefined behavior. Consider passing the required values as arguments to the evaluate function.

Copilot uses AI. Check for mistakes.
@Niek
Copy link
Collaborator

Niek commented Mar 5, 2025

The problem with this is that it's easily detectible by hooking into window.scrollTo(). It would be better to use the native CDP scrolling instead.

@bvandercar-vt bvandercar-vt changed the title feat: scrollTo feat: scroll, scrollTo Mar 5, 2025
@bvandercar-vt
Copy link
Contributor Author

@Niek done, refactored to use the same scroll method as scrollIntoView.

}
},

async scroll (delta: Partial<Vector>, options?: ScrollOptions) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically just moved this code (unchanged) to its own function that is called by both scrollTo and scrollIntoView

@Niek Niek merged commit 5f4243d into Xetera:master Mar 5, 2025
1 check passed
@Niek
Copy link
Collaborator

Niek commented Mar 5, 2025

Amazing! Merged now!

@bvandercar-vt bvandercar-vt deleted the scrollTo branch July 29, 2025 14:16
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.

2 participants