1- // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+ // SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22//
33// SPDX-License-Identifier: GPL-3.0-or-later
44
@@ -17,15 +17,14 @@ NotifyItem {
1717 property int count: 1
1818 readonly property int overlapItemRadius: 12
1919 property bool enableDismissed: true
20- property bool shouldShowClose: false // True when item gets focus from keyboard navigation
2120 property var removedCallback
2221 property alias notifyContent: notifyContent
2322
2423 signal expand ()
2524 signal gotoNextItem ()
2625 signal gotoPrevItem ()
2726
28- property var clearButton: null // Reference to the externally defined clear button
27+ property var clearButton: notifyContent . clearButtonItem
2928
3029 function focusFirstButton () {
3130 // Focus clear button first, then action buttons
@@ -77,18 +76,16 @@ NotifyItem {
7776 focus: true
7877
7978 Keys .onTabPressed : function (event ) {
80- root .shouldShowClose = true
81- if (notifyContent .focusFirstButton ()) {
82- event .accepted = true
83- } else {
79+ if (! notifyContent .focusFirstButton ()) {
8480 root .gotoNextItem ()
85- event .accepted = true
8681 }
82+ event .accepted = true
8783 }
8884
8985 Keys .onBacktabPressed : function (event ) {
90- root .shouldShowClose = true
91- root .gotoPrevItem ()
86+ if (! notifyContent .focusLastButton ()) {
87+ root .gotoPrevItem ()
88+ }
9289 event .accepted = true
9390 }
9491
@@ -106,7 +103,7 @@ NotifyItem {
106103 actions: root .actions
107104 defaultAction: root .defaultAction
108105 // Show close button when: mouse hovers, or item has focus from keyboard navigation
109- parentHovered: impl .hovered || ( root .activeFocus && root . shouldShowClose )
106+ parentHovered: impl .hovered || root .activeFocus
110107 strongInteractive: root .strongInteractive
111108 contentIcon: root .contentIcon
112109 contentRowCount: root .contentRowCount
0 commit comments