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,7 +76,6 @@ NotifyItem {
7776 focus: true
7877
7978 Keys .onTabPressed : function (event ) {
80- root .shouldShowClose = true
8179 if (notifyContent .focusFirstButton ()) {
8280 event .accepted = true
8381 } else {
@@ -87,9 +85,12 @@ NotifyItem {
8785 }
8886
8987 Keys .onBacktabPressed : function (event ) {
90- root .shouldShowClose = true
91- root .gotoPrevItem ()
92- event .accepted = true
88+ if (notifyContent .focusLastButton ()) {
89+ event .accepted = true
90+ } else {
91+ root .gotoPrevItem ()
92+ event .accepted = true
93+ }
9394 }
9495
9596 contentItem: Item {
@@ -106,7 +107,7 @@ NotifyItem {
106107 actions: root .actions
107108 defaultAction: root .defaultAction
108109 // Show close button when: mouse hovers, or item has focus from keyboard navigation
109- parentHovered: impl .hovered || (root .activeFocus && root . shouldShowClose )
110+ parentHovered: impl .hovered || (root .activeFocus )
110111 strongInteractive: root .strongInteractive
111112 contentIcon: root .contentIcon
112113 contentRowCount: root .contentRowCount
0 commit comments