-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add taphold.js to enable web interface context menu on mobile #774
Conversation
taphold.js from https://cdn.jsdelivr.net/npm/ui-contextmenu@1.18.1/lib/jquery-taphold/taphold.js; taphold.min.js from https://cdn.jsdelivr.net/npm/ui-contextmenu@1.18.1/lib/jquery-taphold/taphold.min.js (massaged comment to include author and license). Fixes transmission#464.
40de346
to
b492a26
Compare
I came here to submit the very same PR. Happy to see someone else already on it! |
Doesn't seem to work from Safari/iPhone X. Just the standard magnifier comes up as before the patch. Wondering why... |
Okay, yeah. |
@herebcs, the contextual nav isn’t initialized on mobile devices. That’s any device whose browser’s user agent is matched by the regular expression “(iPhone|iPod|Android)”. |
Good catch. Kinda funny that it works on the iPad because the user agent test for mobile devices is incomplete. Anyway, here's the patch to enable context menus on all mobile devices: diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js
index 4b560ccb3..c3cdedf29 100644
--- a/web/javascript/transmission.js
+++ b/web/javascript/transmission.js
@@ -84,9 +84,10 @@ Transmission.prototype = {
$('#inspector_link').click($.proxy(this.toggleInspector, this));
this.setupSearchBox();
- this.createContextMenu();
};
+ this.createContextMenu();
+
if (this.isMenuEnabled) {
this.createSettingsMenu();
}; I guess the rationale to not enable this on mobile Anyway, I briefly tested this on my iPhone (XS Max, viewport is plenty big for sure), and tap & hold for context menu is hit-and-miss — often enough the info pane is opened when I release my finger. Someone else could look into what mobile-only shenanigans is causing this; the patch is working well enough on my iPad as is, and that's all I ask for. |
Oh, the patch goes into the PR too, since it's about enabling context menu on mobile, not just iPads. |
Thanks guys. Apparently the outcome depends on the position of your finger when you lift it after the long tap. If it is on a menu item then the context menu stays, otherwise (finger between menu items or outside of the context menu) the info pane comes up and you are screwed. Besides that, it works as expected :) |
Not exactly, I can make the context menu stay even when my finger is outside the context menu. Edit: The trick is to move your finger a little bit while holding. Probably breaks the touch event in some way (not a web dev, especially not on mobile, so not sure). |
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.
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.
This is fixed as part of #1476, so I'm closing this issue. |
The taphold feature of jquery-ui-contextmenu is meant to be backed by taphold.js, which is currently missing, as observed in #464. This PR adds it.
taphold.js from https://cdn.jsdelivr.net/npm/ui-contextmenu@1.18.1/lib/jquery-taphold/taphold.js; taphold.min.js from https://cdn.jsdelivr.net/npm/ui-contextmenu@1.18.1/lib/jquery-taphold/taphold.min.js (massaged comment to include author and license).
Fixes #464.