Closed Bug 1109666 Opened 5 years ago Closed 5 years ago

Customize behavior when long-pressing a link


(Firefox for iOS :: Browser, defect)

iOS 7
Not set





(Reporter: st3fan, Assigned: sahil.profile, Mentored)




(1 file)

46 bytes, text/x-github-pull-request
: review+
Details | Review
The WKWebView has a built-in handler for long pressing links. Currently it will show an action sheet with the following options: (Page link), Open, Add to Reading List, Copy, Cancel.

Can we customize this list? Or disable or replace it completely?
Vivek pinged me and expressed interest in contributing to iOS, so I pointed him here as a good place to start investigating.

Vivek, can you look into replacing the "Add to Reading List" option? This will likely involve 1) hiding the existing reading list option, and 2) adding a new reading list option that we can hook into ourselves.
Assignee: nobody → vivekb.balakrishnan
Mentor: bnicholson
Hi I have done the pull request for this Handle the long press on links and shown a custom action sheet like safari.Please let me know your suggestion/feedback.
Hi codester, 
Thanks for the contribution. I'll re-assign this bug to you.
Assignee: vivekb.balakrishnan → sahil.profile
Attached file Pull request
Attachment #8540961 - Flags: review?
OS: Mac OS X → iOS 7
Hardware: x86 → All
Summary: Can we customize what happens when you long press a link? → Customize behavior when long-pressing a link
This is great. I think we have to decide what specific items to put in there since there but I think this is a good start that we can merge in as a first iteration.
Comment on attachment 8540961 [details] [review]
Pull request

Adding brian as a reviewer since he is the mentor for this bug.
Attachment #8540961 - Flags: review?(bnicholson)
Comment on attachment 8540961 [details] [review]
Pull request

Comments in the PR. Overall looks pretty good though. Neat to see the JS->Swift interaction. I think we'll want to formalize a bit there eventually. I looked at Chromium and they have some script loaders that load files, and then just call individual methods from their ObjC code. I think little one line function calls like that would be nice. For now, I'd just at least like to see this code not inline in the Swift.

I wrote Fennec's contextmenu code, so I'm a bit biased about how I want that to look eventually, but I'm fine with it not being there now (in fact, I think landing this in incremental pieces like this is good). Also, maybe people have some good ideas on alternatives.
Attachment #8540961 - Flags: review? → review-
Update the pull request.
I have injected the JavaScript.Also returned the element result as JSON. Done handling of links and Images.
Attachment #8540961 - Flags: review?(bnicholson) → review-
Looking good, but I think this needs another iteration or two before this is ready.
Comment on attachment 8540961 [details] [review]
Pull request

Looks great now.
Attachment #8540961 - Flags: review-
Attachment #8540961 - Flags: review+
Closed: 5 years ago
Resolution: --- → FIXED
Depends on: 1127547
Depends on: 1127606
Depends on: 1129514
Depends on: 1139956
You need to log in before you can comment on or make changes to this bug.