diff --git a/panels/notification/center/GroupNotify.qml b/panels/notification/center/GroupNotify.qml index 6e6187024..29c607a54 100644 --- a/panels/notification/center/GroupNotify.qml +++ b/panels/notification/center/GroupNotify.qml @@ -18,6 +18,10 @@ NotifyItem { signal gotoNextItem() // Signal to navigate to next notify item signal gotoPrevItem() // Signal to navigate to previous notify item + function resetFocus() { + impl.forceActiveFocus() + } + // Focus the first button for Tab navigation into group function focusFirstButton() { foldBtn.forceActiveFocus() diff --git a/panels/notification/center/NormalNotify.qml b/panels/notification/center/NormalNotify.qml index 77324eef8..593443381 100644 --- a/panels/notification/center/NormalNotify.qml +++ b/panels/notification/center/NormalNotify.qml @@ -17,6 +17,10 @@ NotifyItem { signal gotoNextItem() signal gotoPrevItem() + function resetFocus() { + impl.forceActiveFocus() + } + function focusFirstButton() { return notifyContent.focusFirstButton() } diff --git a/panels/notification/center/NotifyView.qml b/panels/notification/center/NotifyView.qml index cf041c06e..d58fa671a 100644 --- a/panels/notification/center/NotifyView.qml +++ b/panels/notification/center/NotifyView.qml @@ -38,6 +38,7 @@ Control { function tryFocus(retries) { let item = view.itemAtIndex(idx) if (item && item.enabled) { + item.resetFocus() if (!item.focusFirstButton()) { item.forceActiveFocus() } diff --git a/panels/notification/center/NotifyViewDelegate.qml b/panels/notification/center/NotifyViewDelegate.qml index a03bff0d8..bbec8e4b9 100644 --- a/panels/notification/center/NotifyViewDelegate.qml +++ b/panels/notification/center/NotifyViewDelegate.qml @@ -26,6 +26,7 @@ DelegateChooser { Qt.callLater(function() { let nextItem = view.itemAtIndex(currentIndex + 1) if (nextItem && nextItem.enabled) { + nextItem.resetFocus() nextItem.forceActiveFocus() } }) diff --git a/panels/notification/center/OverlapNotify.qml b/panels/notification/center/OverlapNotify.qml index 817297340..818e7ad6e 100644 --- a/panels/notification/center/OverlapNotify.qml +++ b/panels/notification/center/OverlapNotify.qml @@ -26,6 +26,10 @@ NotifyItem { property var clearButton: notifyContent.clearButtonItem + function resetFocus() { + impl.forceActiveFocus() + } + function focusFirstButton() { // Focus clear button first, then action buttons if (clearButton && clearButton.enabled && clearButton.visible) { diff --git a/panels/notification/plugin/NotifyItemContent.qml b/panels/notification/plugin/NotifyItemContent.qml index b0fb50e4f..740f0da65 100644 --- a/panels/notification/plugin/NotifyItemContent.qml +++ b/panels/notification/plugin/NotifyItemContent.qml @@ -340,7 +340,14 @@ NotifyItem { // From action buttons, go directly to next notification item root.gotoNextItem() } - onGotoPrevItem: root.gotoPrevItem() + onGotoPrevItem: { + // Try to focus close button first, if not available go to prev item + if (clearLoader.item && clearLoader.item.enabled) { + clearLoader.item.forceActiveFocus() + } else { + root.gotoPrevItem() + } + } } } }