https://bugs.kde.org/show_bug.cgi?id=520267

            Bug ID: 520267
           Summary: Search field loses keyboard focus on first keystroke
                    when mouse is over a result item (blockingHoverFocus
                    not set during view transition)
    Classification: Plasma
           Product: plasmashell
      Version First 6.4.2
       Reported In:
          Platform: openSUSE
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Application Launcher (Kickoff) widget
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
  Target Milestone: 1.0

STEPS TO REPRODUCE
1. Position mouse cursor in the center area where search results will appear
2. Press Meta key to open Kickoff
3. Type a single letter (e.g., "F")
4. Notice the search field has lost focus - subsequent keystrokes are ignored

OBSERVED RESULT
The search field loses keyboard focus as soon as the search results list
appears. The item under the mouse cursor receives forceActiveFocus(), stealing
focus from the text field. Any further keystrokes are not registered — the user
must click the text field with the mouse to regain focus.

EXPECTED RESULT
Keyboard focus should remain in the search text field while typing, regardless
of where the mouse cursor is positioned. Hover should not steal focus from the
search field during active text input.

TECHNICAL ROOT CAUSE
In
/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/FullRepresentation.qml,
the onSearchTextChanged handler has a logic gap:

When the first keystroke triggers a transition from NormalPage to searchView
(currentItem.objectName !== "searchView"), the code calls
contentItemStackView.replace(searchViewComponent) but does NOT set
root.blockingHoverFocus = true beforehand. blockingHoverFocus is only set to
true on subsequent keystrokes (the else branch for when the searchView is
already active).

Because blockingHoverFocus remains false during the initial view replacement,
the MouseArea in AbstractKickoffItemDelegate.qml has hoverEnabled: true (since
!kickoff.fullRepresentationItem.blockingHoverFocus is true). As the search
result delegate items are created, if the mouse is already positioned over
where a result appears, onEntered fires, calling
forceActiveFocus(Qt.MouseFocusReason) on the result item, which steals focus
from the search text field.

SUGGESTED FIX
Add root.blockingHoverFocus = true before
contentItemStackView.replace(searchViewComponent) in the first branch of the
onSearchTextChanged handler in FullRepresentation.qml:

Current code (lines ~188-190):
    } else if (root.header.searchText.length > 0) {
        if (contentItemStackView.currentItem.objectName !== "searchView") {
            contentItemStackView.reverseTransitions = false
            contentItemStackView.replace(searchViewComponent)

Should become:
    } else if (root.header.searchText.length > 0) {
        if (contentItemStackView.currentItem.objectName !== "searchView") {
+           root.blockingHoverFocus = true
            contentItemStackView.reverseTransitions = false
            contentItemStackView.replace(searchViewComponent)

SOFTWARE/OS VERSIONS
Linux Distribution: openSUSE Leap 16.0
KDE Plasma Version: 6.4.2
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.12.0-160000.30-default (64-bit)
Graphics Platform: Wayland

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to