Bug 466192 - Application launcher switches selection on autocomplete to mouse position
Summary: Application launcher switches selection on autocomplete to mouse position
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Launcher (Kickoff) (show other bugs)
Version: 5.27.0
Platform: Neon Linux
: HI minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
: 467304 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-21 12:54 UTC by Matija
Modified: 2023-08-05 03:49 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.7


Attachments
Screen recording of reproducing the bug (352.13 KB, video/mp4)
2023-04-13 09:55 UTC, Prajna Sariputra
Details
Screen recording of an item getting selected despite the mouse not being over the launcher (213.20 KB, video/mp4)
2023-04-13 09:57 UTC, Prajna Sariputra
Details
Video for debugging idea from Comment #5 (1.13 MB, video/mp4)
2023-04-13 13:42 UTC, Matija
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matija 2023-02-21 12:54:58 UTC
SUMMARY
When in application launcher and you search for an item, filtering of the results follows and the selection jumps on an listed item that is under the mouse pointer, instead of the first listed item.
Thus on the Enter key you activate totally different result.

STEPS TO REPRODUCE
1. Open Application Launcher (either with a mouse or with ESC key, Super key or Alt+F1 combo)
2. Type something in to get a list of results
3. Position the mouse above an item...for instance on 3rd/4th item, so it is highlighted/selected
4. Don't move the mouse, but exit the app launcher (ESC/Super key or Alt+F1 combo)
5. Reopen the app launcher
6. Start typing something that returns a list of results

OBSERVED RESULT
When you stop typing and get the result, upon hitting Enter, you activate the item under the mouse pointer

EXPECTED RESULT
When you stop typing and get the result, first item in the list is selected and upon hitting Enter, you activate the that (correct) item

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
X11, haven't tested on Wayland
Comment 1 Prajna Sariputra 2023-04-13 09:49:49 UTC
I can reproduce this on Plasma 5.27.4 on Wayland, although the reproduction steps are a bit different in my case (will attach a screen recording showing the issue as well):

1. Open the application launcher with the Meta/Super key
2. Press the E key
3. Move the cursor to the 4th item, making sure it is highlighted (and not touch the mouse again from here on out)
4. Close the application launcher by pressing Esc
5. Open the application launcher with the Meta/Super key again
6. Press the E key
7. Wait a second or two
8. Press the D key

By step 8 the issue appears for me, but if I stop at step 6 the issue does not appear, and if I press E followed by D quickly the issue also doesn't appear, but if I type "ed" quickly, wait a second and then type another letter the issue appears again.

Also, the issue has been affecting me for a while, but only now have I found out good steps to reproduce it thanks to this bug report.
Comment 2 Prajna Sariputra 2023-04-13 09:55:00 UTC
Created attachment 158066 [details]
Screen recording of reproducing the bug
Comment 3 Prajna Sariputra 2023-04-13 09:57:14 UTC
Created attachment 158067 [details]
Screen recording of an item getting selected despite the mouse not being over the launcher

In addition, once the bug has been triggered plasmashell still seems to remember the old cursor position even after closing the launcher and having the mouse be nowhere near it at all.
Comment 4 Patrick Silva 2023-04-13 11:47:54 UTC
(In reply to Prajna Sariputra from comment #3)
> Created attachment 158067 [details]
> Screen recording of an item getting selected despite the mouse not being
> over the launcher
> 
> In addition, once the bug has been triggered plasmashell still seems to
> remember the old cursor position even after closing the launcher and having
> the mouse be nowhere near it at all.

See bug 454349
Comment 5 Matija 2023-04-13 13:35:51 UTC
(In reply to Prajna Sariputra from comment #1)
> I can reproduce this on Plasma 5.27.4 on Wayland, although the reproduction
> steps are a bit different in my case (will attach a screen recording showing
> the issue as well):
> 
> 1. Open the application launcher with the Meta/Super key
> 2. Press the E key
> 3. Move the cursor to the 4th item, making sure it is highlighted (and not
> touch the mouse again from here on out)
> 4. Close the application launcher by pressing Esc
> 5. Open the application launcher with the Meta/Super key again
> 6. Press the E key
> 7. Wait a second or two
> 8. Press the D key
> 
> By step 8 the issue appears for me, but if I stop at step 6 the issue does
> not appear, and if I press E followed by D quickly the issue also doesn't
> appear, but if I type "ed" quickly, wait a second and then type another
> letter the issue appears again.
> 
> Also, the issue has been affecting me for a while, but only now have I found
> out good steps to reproduce it thanks to this bug report.

The highlighting problem has something to do with the accuracy of the search and memorizing/matching the position under cursor.

A few tips for debugging:
1. Nothing happens when starting the search term with one letter. The case when it's triggered is when you start deleting chars from a word and end with one letter.
2. If I type really fast "man" or "file" it doesn't jump to mouse cursor.
Why? I come from web dev world, so I presume because keyup/down event doesn't fire in that case.

3. Only if typed slower, when keyup/down events are fired, it seems to save the resulting list on each key event and then by some logic, saves the position of the item that does satisfy the search term (in one of the steps between additional characters), and passive mouse pointer activates it.

If under the mouse cursor ever existed (in between each char entered) a positive find, it will jump to that instead of the first item.

So:
1. open launcher
2. type char ("f" for instance)
3. nothing happens as there are too many results and this is only the first step in searching
4. wait a second
5. type another char ("i" for instance)
6. it jumps to the item under mouse cursor as there was a positive match in the step before (although not in current step anymore)

vs

1. open launcher
2. type FAST "fi"
3. there are no akward jumps

Attaching a video recording of the above
Comment 6 Matija 2023-04-13 13:42:14 UTC
Created attachment 158072 [details]
Video for debugging idea from Comment #5
Comment 7 Fushan Wen 2023-04-13 16:11:26 UTC
*** Bug 467637 has been marked as a duplicate of this bug. ***
Comment 8 Fushan Wen 2023-04-13 16:11:49 UTC
*** Bug 467304 has been marked as a duplicate of this bug. ***
Comment 9 Bug Janitor Service 2023-07-23 18:40:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1619
Comment 10 Bug Janitor Service 2023-07-23 18:47:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1620
Comment 11 Fushan Wen 2023-07-29 00:12:04 UTC
Git commit fc85def499318caae360462568e239a1eeb7d61e by Fushan Wen.
Committed on 29/07/2023 at 02:11.
Pushed by fusionfuture into branch 'master'.

applets/kickoff: add blocker to prevent focus change in search view

This adds a mouse position interceptor to record the mouse position
after entering a new search term, and if there is no mouse movement,
block focus on child items.
FIXED-IN: 5.27.7

M  +1    -1    applets/kickoff/package/contents/ui/AbstractKickoffItemDelegate.qml
M  +36   -3    applets/kickoff/package/contents/ui/FullRepresentation.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/fc85def499318caae360462568e239a1eeb7d61e
Comment 12 Fushan Wen 2023-07-29 00:22:32 UTC
Git commit 717465388631796747cd8f2061650a0abed19bee by Fushan Wen.
Committed on 29/07/2023 at 02:18.
Pushed by fusionfuture into branch 'Plasma/5.27'.

applets/kickoff: add blocker to prevent focus change in search view

This adds a mouse position interceptor to record the mouse position
after entering a new search term, and if there is no mouse movement,
block focus on child items.
FIXED-IN: 5.27.7

(cherry picked from commit fc85def499318caae360462568e239a1eeb7d61e)

M  +1    -1    applets/kickoff/package/contents/ui/AbstractKickoffItemDelegate.qml
M  +36   -3    applets/kickoff/package/contents/ui/FullRepresentation.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/717465388631796747cd8f2061650a0abed19bee