Bug 423688 - When menu is opened under mouse cursor, cursor up key press does not work as first key
Summary: When menu is opened under mouse cursor, cursor up key press does not work as ...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Menu (Kicker) widget (other bugs)
Version First Reported In: 5.19.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-30 08:37 UTC by Frank Steinmetzger
Modified: 2025-06-09 18:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Steinmetzger 2020-06-30 08:37:49 UTC
SUMMARY
Usually I switch off my machine for the day by going into suspend-to-ram. I do this via keyboard thus:

STEPS TO REPRODUCE
1. press Super key → the „classic“ application menu appears
2. press cursor up-right-up-up-enter to select Session→Sleep

OBSERVED RESULT
If the mouse cursor is in the area where the menu appears, it does not react to the first cursor up keypress anymore, only to the cursor down key. So I have to either move the mouse out of the way and re-open the menu with double-Super-key or press cursor down-up to first select the top and then the bottom item. I’ve been observing this behaviour for a long while now, I can’t tell for how long.

EXPECTED RESULT
The cursor key should work to directly select the bottom-most menu item. This did work in the past (the described process is etched into my muscle memory).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 5.19.1
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0
Comment 1 Noah Davis 2023-08-03 22:02:35 UTC
Confirmed with 5.26.1.

I think the issue is in the `MouseEventListener` of plasma-desktop/applets/kicker/package/contents/ui/ItemListView.qml

```
MouseEventListener {
    id: listener

    anchors.fill: parent

    hoverEnabled: true

    onContainsMouseChanged: {
        listView.eligibleWidth = listView.width;

        if (containsMouse) { // <-- This should be overridden or avoided when the menu is opened
            resetIndexTimer.stop();
            itemList.forceActiveFocus();
        } else if ((!itemList.childDialog || !dialog)
            && (!currentItem || !currentItem.menu.opened)) {
            resetIndexTimer.start();
        }
    }
// [snip]
}
```
Comment 2 Bug Janitor Service 2025-06-05 11:27:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/3042
Comment 3 cwo 2025-06-05 17:22:32 UTC
Git commit 09fbef3e6f651836f08484f1e9d6dbd85bf750cc by Christoph Wolk.
Committed on 05/06/2025 at 15:19.
Pushed by cwo into branch 'master'.

applets/kicker: don't trigger hover on keyboard open

Kicker's MenuRepresentation uses MouseEventListener's positionChanged
to do its hover activation handling, and unlike standard QQC components'
hovered property, it activates immediately on spawn even if the mouse
was not actively moved. This makes keyboard use rather inconvenient, as
the behavior differs based on the position where the pointer is when the
user triggers the launcher.

Instead, we ignore the first positionChanged event on each opening of
kicker. This does not notably affect mouse use (the user has to move one
additional pixel when moving from icon to menu), but makes shortcut-
triggered keyboard use much more pleasant. In the medium term, it
probably makes sense to port this to standard components (ItemDelegate,
standard TriangleMouseFilter instead of an incomplete custom
implementation etc,), but given the complexity and lots of custom
behavior of kicker, this is likely a larger undertaking.
FIXED-IN: 6.4.0

M  +4    -0    applets/kicker/package/contents/ui/ItemListDelegate.qml
M  +2    -0    applets/kicker/package/contents/ui/ItemListView.qml
M  +3    -0    applets/kicker/package/contents/ui/MenuRepresentation.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/09fbef3e6f651836f08484f1e9d6dbd85bf750cc
Comment 4 cwo 2025-06-09 18:40:01 UTC
Git commit eaa82f56521eb76f4956c9c853d4e7045cf1f72b by Christoph Wolk.
Committed on 09/06/2025 at 17:56.
Pushed by cwo into branch 'Plasma/6.4'.

applets/kicker: don't trigger hover on keyboard open

Kicker's MenuRepresentation uses MouseEventListener's positionChanged
to do its hover activation handling, and unlike standard QQC components'
hovered property, it activates immediately on spawn even if the mouse
was not actively moved. This makes keyboard use rather inconvenient, as
the behavior differs based on the position where the pointer is when the
user triggers the launcher.

Instead, we ignore the first positionChanged event on each opening of
kicker. This does not notably affect mouse use (the user has to move one
additional pixel when moving from icon to menu), but makes shortcut-
triggered keyboard use much more pleasant. In the medium term, it
probably makes sense to port this to standard components (ItemDelegate,
standard TriangleMouseFilter instead of an incomplete custom
implementation etc,), but given the complexity and lots of custom
behavior of kicker, this is likely a larger undertaking.
FIXED-IN: 6.4.0


(cherry picked from commit 09fbef3e6f651836f08484f1e9d6dbd85bf750cc)

Co-authored-by: Christoph Wolk <cwo.kde@posteo.net>

M  +4    -0    applets/kicker/package/contents/ui/ItemListDelegate.qml
M  +2    -0    applets/kicker/package/contents/ui/ItemListView.qml
M  +3    -0    applets/kicker/package/contents/ui/MenuRepresentation.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/eaa82f56521eb76f4956c9c853d4e7045cf1f72b