-
Notifications
You must be signed in to change notification settings - Fork 121
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
base: main
Are you sure you want to change the base?
Don't cancel gesture if touch is > 100 pixels away #2607
Conversation
const importText = ` | ||
- ${cursor}` | ||
|
||
await page.emulate(iPhone) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 👍
#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.