Bug 456231

Summary: Previous mouse selection active when kickoff launched and navigated using keyboard
Product: [Plasma] plasmashell Reporter: Abhijeet Viswa <abhijeetviswa>
Component: Application Launcher (Kickoff)Assignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: abhijeetviswa, bugseforuns, enricobe, kroot001, me, mikel5764, miranda, nate, noahadvs, postix
Priority: NOR Keywords: usability
Version: master   
Target Milestone: 1.0   
Platform: Compiled Sources   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=454349
Latest Commit: Version Fixed In: 6.0
Attachments: Steps to reproduce/demo of bug

Description Abhijeet Viswa 2022-07-02 08:02:27 UTC
Created attachment 150335 [details]
Steps to reproduce/demo of bug

SUMMARY
When you use the mouse to select an item from the search list view and then the plasmoid is relaunched, as long as the mouse never lands on top of the plasmoid, the previous search list element will be highlighted.

This is not strictly restricted to search. It is reproducible in any list/grid view of Kickoff.

STEPS TO REPRODUCE
1. Search for something
2. Use mouse to click and open an item from the list
3. Once plasmoid closes, move mouse away to different part of screen
4. Reopen plasmoid once again (using mouse, keyboard shortcut etc).. Ensure mouse is never on top of plasmoid full representation
5. Search for something using keyboard
6. If it's the same search term, the previously clicked on item will be activated/highlighted\

(Check Video attachment, each time I type in 'f' into the search field, the previous selection becomes highlighted after a half a second or so)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.18 Linux Zen, KDE master branch (compiled from source)
(available in About System) 
Qt Version: 5.15.5+kde+r166-1 and 6.3.1-1 (from the Arch repos, not sure which one KDE uses)

DEBUGGING INSIGHT
I tried debugging this and finally realized it had to do with how the `onEntered` handler is triggered in `KickoffItemDelegate`'s `MouseArea`. If you dig deep enough, you'll realize that the `containsMouse` property is `true`. Further items in other lists can also be active (for example, favorites grid/list view or applications list view).

Essentially, the mouse pointer position doesn't get updated and remains at the previous value (when we made the first mouse click in Step 2) even after relaunching the plasmoid. My QML experience is limited and I don't know how to fix this. 

If anyone has any insights on how to fix it, I can provide a patch. 
Also, this is a possible 15-Minute bug.
Comment 1 Nate Graham 2022-07-05 16:38:55 UTC

*** This bug has been marked as a duplicate of bug 455674 ***
Comment 2 Nate Graham 2022-11-04 13:41:25 UTC
Still happening despite the fix for Bug 455674; re-opening.
Comment 3 Iyán Méndez Veiga 2022-11-05 09:49:45 UTC
For me the current issue is not actually exactly as described here. In my case, this bug is not triggered by previous mouse selection, but by particular searches, that I can replicate all the times. For example, if I type "Firefox" it doesn't trigger the bug, but if I search "PyCharm" it always does.

One more hint to try to debug this. If I enable the "Use compact list item style", I cannot replicate the issue anymore.
Comment 4 Nate Graham 2022-11-05 14:25:20 UTC
I did some testing, and for me it does somehow seem to be related to the previous mouse selection.

If I type "fire" it works, but the moment I type the next "f" -- making the search field show "firef" -- an item at the bottom of the view corresponding to the previous mouse selected item becomes selected.

If this doesn't sounds like the issue you're seeing, could you open a new bug report about it? There may be two issues, or two different manifestations of a common underlying issue.
Comment 5 Enrico 2022-11-19 19:43:54 UTC
I have this kind of bug as well. Unfortunately I can't find a specific pattern to reproduce it.
It's definitely related to some mouse click, but I can't find how to trigger it. When it happens (very often) the behavior is the same showed in the first video

Operating System: KDE neon 5.26
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 5.15.0-53-generic (64-bit)
Graphics Platform: Wayland
Comment 6 Nate Graham 2023-09-12 20:10:19 UTC
This has been fixed for Plasma 6!

There's still a related but not identical issue in that the *category* item under the cursor is inappropriately selected on open. That's tracked with Bug 447278.