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

Web Interface - Context Menu From Touch Devices #464

Closed
smwa opened this issue Dec 25, 2017 · 18 comments · Fixed by #5928
Closed

Web Interface - Context Menu From Touch Devices #464

smwa opened this issue Dec 25, 2017 · 18 comments · Fixed by #5928

Comments

@smwa
Copy link

smwa commented Dec 25, 2017

I often use the "Trash Data and Remove From List" option in the context menu from the web interface. I cannot get the context menu to work from my phone.

It might be possible to upgrade to the newest contextmenu version to solve this. Otherwise I would vote to add listeners for touch events.

An alternative might be adding the same options in the info pane somewhere.

Has anyone else found this to be an issue?

@smwa
Copy link
Author

smwa commented Jan 8, 2018

It seems that when the contextmenu was implemented, they expected to use the "taphold" menu(per the "taphold: true" in transmission.js), but that library has not been included

@sebastian-king
Copy link

I'm very interested in this too, I tried adding the taphold.js library to the website, however it does not appear to work on touch devices for me--it worked fine on desktop browsers. It will likely need some debugging to make it work with the torrent rows. When I have some spare time I will start work on this.

@sebastian-king
Copy link

I've got a rudimentary working version. The context menu appears when pressing on a torrent in the list for 0.75 seconds.

This in it's current state is kind of a workaround though, it needs to be cleaned up, the code put in the correct places, and more testing is needed to find bugs. I will do all of this and eventually when it is ready I will make a PR.

There is already one noticable bug which is that it seems it doesn't work if I press on the bottom right part of the torrent row. Any testing/bugs feedback would be appreciated.

Note: this does not require or use the taphold.js or jquery-mobile.js libraries.

Added this to main.js (I know it is not supposed to go there, but it works for now).

    var timer;
    var taphold;

    $("ul.torrent_list").on("touchstart", "li.torrent", function(e) {
            taphold = false;
            timer = setTimeout(function() {
                    taphold = true;
                    $("ul#torrent_list").contextmenu("open", $(e.target).closest('.torrent_name'));
            }, 750);
    });

    $("ul.torrent_list").on("touchend", "li.torrent", function(e) {
            if(taphold) {
                    e.preventDefault();
            } else {
                    clearTimeout(timer);
            }
    });

Add this to common.css (to stop the text being highlighted instead of the tap and hold effect):
[this probably should only be run on the mobile version, but I kind of like the behaviour on the desktop version and it stops highlighting torrent names when I double-click]

  .torrent_list {
             -webkit-touch-callout: none; /* iOS Safari */
             -webkit-user-select: none; /* Safari */
             -khtml-user-select: none; /* Konqueror HTML */
             -moz-user-select: none; /* Firefox */
             -ms-user-select: none; /* Internet Explorer/Edge */
             user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
   }

And last, taphold: true should probably be changed to taphold: false in the transmission.js file just to avoid conflicts.

If you use it please provide feedback!

@smwa
Copy link
Author

smwa commented Feb 13, 2018

Thanks for the work @sebastian-king!

I hate to have to add our own event listeners, but if contextmenu.js isn't handling it properly then this looks nice to me.

"var taphold" and "var timer" might be better named "var isTouchStarted" and "var timerLongTouch", or something else more descriptive.

I'm sure you understand the transmission web code better than I. Would you put the 2 functions(on 'touchstart' and on 'touchend') into functions on the transmission.js class? This would let you put only 2 calls into main.js. I suppose they would look like:

document.getElementById("torrent_list").addEventListener("touchstart", transmission.listTouchStart); document.getElementById("torrent_list").addEventListener("touchend", transmission.listTouchEnd);

@zmwangx
Copy link

zmwangx commented Dec 4, 2018

I ran into this myself on my iPad just now. Contrary to @sebastian-king's experience, I added https://cdn.jsdelivr.net/npm/ui-contextmenu@1.18.1/lib/jquery-taphold/taphold.js and it immediately worked, not sure if he was using a bad version or had an incompatible browser.

Anyway, I submitted #774. Not really expecting it to be merged, but hopefully it may help someone else.

@abercrave
Copy link

I had actually added taphold.min.js myself independently and can confirm @zmwangx's PR #774 will work perfectly. With the plugin in place iOS Chrome and Safari display the expected contextual menu.

cfpp2p pushed a commit to cfpp2p/transmission that referenced this issue Jan 28, 2019
Thanks @zmwangx
transmission/transmission#774
transmission/transmission#464

Implements a tap and hold functionality. Click/tap and hold for 1s (default) triggers taphold event. Click/tap and release triggers normal click event.
cfpp2p pushed a commit to cfpp2p/transmission that referenced this issue Jan 28, 2019
Thanks @zmwangx
transmission/transmission#774
transmission/transmission#464

Implements a tap and hold functionality. Click/tap and hold for 1s (default) triggers taphold event. Click/tap and release triggers normal click event.
@sameignatovich
Copy link

Hello everyone.
I just tried to tap and hold, but Safari begins to highlight context.
Can you add some button/dots/burger for context menu on each torrent?

@mfedoseev
Copy link

Hi! Same here. Cannot open the context menu from mobile Safari. It just starts to highlight text and progress bars. So I'm unable to verify or trash local data… Hoping for a fix?

@ckerr
Copy link
Member

ckerr commented Jan 25, 2022

The web client refresh in #1476 fixes this. It will be included in the next stable release and is available now in the nightly builds.

@ckerr ckerr closed this as completed Jan 25, 2022
@michaelkrieger
Copy link

To confirm, am I supposed to be able to bring up a context menu to change folders or similar from iOS Safari on an iPad or iPhone?

@ckerr
Copy link
Member

ckerr commented Mar 8, 2023

Should be able to, yeah

@beville
Copy link

beville commented Mar 31, 2023

This works on my Android phone. In Chrome browser, I’m able to long press on an item, and I get the context menu.

However, on my iPad, in Safari, the long press only selects text and the progress bars.

Running 4.0.2.

@cwanja
Copy link

cwanja commented Jun 13, 2023

Can confirm that pressing and holding on an item does not bring up a context menu at all. Neither does pressing and holding on a button.

@slokhorst
Copy link
Contributor

@cwanja what browser, operating system, and version of Transmission are you using?

@cwanja
Copy link

cwanja commented Jun 20, 2023

@cwanja what browser, operating system, and version of Transmission are you using?

@slokhorst iOS 16.5, Safari, 3.0. Transmission runs on an Ubuntu host.

@slokhorst
Copy link
Contributor

It seems like the new implementation uses the contextmenu event to detect a right click/long press. This is event is supported on all browsers, except for Safari on iOS (as of version 16.5).

So, in order to get this working on (the current) Safari on iOS, a workaround would need to be implemented.

@iamrgroot
Copy link

It seems like the new implementation uses the contextmenu event to detect a right click/long press. This is event is supported on all browsers, except for Safari on iOS (as of version 16.5).

So, in order to get this working on (the current) Safari on iOS, a workaround would need to be implemented.

I cannot find any reference to this in open issues. Is this being worked on and am I missing something or should I open a new issue?

@Rukario
Copy link
Contributor

Rukario commented Aug 15, 2023

It never worked in iPadOS/iOS. I'm waiting for #5827 to ship then there'll be another PR focused on bringing context menu to touch devices featuring iPad and iPhone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet