Customize behavior when long-pressing a link

RESOLVED FIXED

Status

()

Firefox for iOS
Browser
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: st3fan, Assigned: codester, Mentored)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

46 bytes, text/x-github-pull-request
bnicholson
: review+
Details | Review | Splinter Review
(Reporter)

Description

4 years ago
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
Status: NEW → ASSIGNED
(Assignee)

Comment 2

4 years ago
Hi I have done the pull request for this https://github.com/mozilla/firefox-ios/pull/61. 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
Created attachment 8540961 [details] [review]
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
(Reporter)

Comment 5

4 years ago
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.
(Reporter)

Comment 6

4 years ago
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-
(Assignee)

Comment 8

4 years ago
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+
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Depends on: 1127547
Depends on: 1127606
Depends on: 1129514
(Reporter)

Updated

3 years ago
Depends on: 1139956
You need to log in before you can comment on or make changes to this bug.