Skip to content

Click to sort broken in Chrome browsers #3001

@pingmurder

Description

@pingmurder

Please complete the following tasks.

  • Web browser cache cleared
  • Link provided to install script if applicable
  • Not using broken rtinst install script
  • Web browser, ruTorrent, PHP and OS version provided

Tell us about your environment

Browser: Chrome
rutorrent version: 5.2.10

Affected browsers: Chrome, Chromium-based (Arc, Edge, Brave, etc.)
Works in: Firefox

Root cause: Chrome fires phantom mousemove events on every mousedown/mouseup (click) even when the mouse hasn't physically moved. These phantom events have movementX === 0 and movementY === 0.

In js/stable.js, the DnD instance's onRun callback unconditionally sets isMoving = true on any mousemove. When onFinish fires on mouseup, it checks isMoving — if true, it calls colDragMoveEnd() (column reorder) instead of
Sort(). So every click in Chrome triggers the drag path instead of the sort path.

History: This was previously fixed in PR #1637 using an ignoreNextMove boolean flag, but that fix was lost when the codebase was refactored to use the DnD class.

Fix: In js/stable.js, in the onRun callback of the DnD constructor (~line 164), add a guard to ignore zero-movement mousemove events before setting isMoving:

onRun: (ev) => {
if (this.isResizing) {
this.colDragResize(ev);
} else {
// Ignore phantom mousemove events (Chrome fires mousemove on click
// even when the mouse hasn't moved, which prevents sorting)
if (ev.originalEvent.movementX === 0 && ev.originalEvent.movementY === 0) return;
this.isMoving = true;
this.isSorting = false;
this.colDragMove(ev);
}
},

Related issues: #1195, #1685, PR #1637

Tell us how you installed ruTorrent

manual install

Describe the bug

Chrome fires phantom mousemove events on every mousedown/mouseup (click) even when the mouse hasn't physically moved. These phantom events have movementX === 0 and movementY === 0.

Steps to reproduce

Click on labels to sort in chrome while running current version of rutorrent

Expected behavior

clicking on labels should sort the column

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions