BiglySoftware / BiglyBT-plugin-xmwebui

This plugin supports the BiglyBT Web Remote interface.
8 stars 7 forks source link

Torrent right-click context menu jumps to top left on taphold (touch pad and touch devices) #8

Closed SamiJ closed 3 years ago

SamiJ commented 3 years ago

Hi folks, Good job with BiglyBT, loving it on my Shield TV setup.

I did run into a small bug when accessing BiglyBT via the remote client. On Chrome v91 running on MacOS v11.5, using touchpad right click causes the context menu to first appear briefly on the correct spot - at the cursor - after which it immediately jumps to top left.

Digging further, touchpads seems to trigger a mouseEvent first, followed by a taphold event. The jQuery taphold event doesn't seem to have the pageX / pageY props for positioning, so the context menu jumps to the default position.

This can be reproduced with any taphold action, e.g. by pressing a mouse button for 1s+ on top of a torrent.

This can be fixed by using the original event (which does have the coords) instead of the jQuery one. Adding the following invocation to context menu options in transmission.js does the trick:

$("ul#torrent_list").contextmenu({
    // ...
    position: function (event) {
        // Use originalEvent positioning for better taphold support on touch devices
            return { of: event.originalEvent }
        },
    // ...