Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't cancel gesture if touch is > 100 pixels away #2607

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ethan-james
Copy link
Collaborator

#1705

Get the bounding client rect for the current selection (if applicable) and only abandon a gesture if the touchstart coordinates are within a box that extends 100 pixels out from the client rect.

const importText = `
- ${cursor}`

await page.emulate(iPhone)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@raineorshine @trevinhofmann I cannot for the life of me get puppeteer to simulate a selection while emulating a mobile browser. I'll give it another try on Monday, but please let me know if you have any experience getting it to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for trying! If it's difficult/impossible I'm okay skimping on test coverage here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try creating a selection with touch events, or by directly accessing the browser selection API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did try directly accessing the browser selection API, and found that it wouldn't hold onto the selection once it left the page.evaluate block. That might be worth another try, but I didn't have much luck the first time.

As for creating the selection with touch events, I tried to use a physical device to figure out how that would work, and it seemed like the only way to get a selection was to tap and then use the tooltip menu to "Select All". I don't think the tooltip menu appears in the Puppeteer emulator. If you know another, more reliable way to tap to create a a selection, please do let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

A double tap selects the word under the touch. I imagine you will run into the same issue though in which the selection is lost after the page.evaluate.

We will have to rely on manual testing for this one 👍

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