Bug 443169

Summary: Clicking with mouse "back" or "forward" buttons while hovering items selects and potentially drags them
Product: [Frameworks and Libraries] frameworks-kio Reporter: Eduardo <eduardo.cruz>
Component: Open/save dialogsAssignee: KIO Bugs <kio-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kdelibs-bugs-null, nate
Priority: NOR    
Version First Reported In: 5.86.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Eduardo 2021-09-30 20:42:11 UTC
SUMMARY
Many modern mice have extra buttons, some of them are used to navigate "back" and "forward", usually placed in the thumb region.

When using KDE's open or save file dialog we are able to use these buttons to "back" and "forward" through our folder history.

However, if we are hovering the mouse pointer above a an item (file or folder) at the dialog while we click these buttons, it actually select the items before doing the navigation. If we happen to me moving the mouse pointer even slightly, it actually starts a drag operation on the item that we were hovering.

In fact, if the mouse has other extra unassigned buttons, any/all of them can be used to trigger this bug.

STEPS TO REPRODUCE
1. Own a mouse with "back" and "forward" buttons
2. Open KWrite, open the "Open File" dialog
3. Click & hold with your "back" button over some file/folder shown at the dialog
4. Move your mouse while holding the "back" button

OBSERVED RESULT
You are now dragging them item while holding the "back" button

EXPECTED RESULT
It should have simply navigate "back" with the button down event (if you had a folder history) without initiating any unintended drag operation.


SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Graphics Platform: X11

ADDITIONAL INFORMATION
In Dolphin, the behavior is correct. It can be taken as a reference behavior to be replicated in the open/save file dialogs.
Comment 1 Méven 2024-11-14 17:37:54 UTC
Git commit 54bcd32cd61aa9332d496fb49a19028f665a1643 by Méven Car, on behalf of Sean Baggaley.
Committed on 14/11/2024 at 12:10.
Pushed by meven into branch 'master'.

KDirOperator: improve handling of forward/back mouse buttons

Since the the forward and back mouse buttons would
be passed through to the underlying Qt widget which handles it
like any other click, this meant single-clicking with these
buttons would allow selecting and dragging items, and double-clicking
would open files or folders, instead of just navigating through the
history as expected.

These buttons are now handled when pressed, not released; this
preventing being able to drag items, and bringing behaviour in
line with Dolphin. Double-click events for these buttons are now
properly handled. The events are then discarded to stop single-clicks
selecting items, or double-clicks opening files or folders.

M  +17   -11   src/filewidgets/kdiroperator.cpp

https://invent.kde.org/frameworks/kio/-/commit/54bcd32cd61aa9332d496fb49a19028f665a1643