From 74c682d76a6141f7430e95eecac0ea6c43f032a8 Mon Sep 17 00:00:00 2001
From: Benjamin Arnaud <benjamin.arnaud@videolabs.io>
Date: Tue, 24 Aug 2021 14:06:46 +0200
Subject: [PATCH] qml/MainDisplay: Fix keyboard focus loss when clearing the
 'localMenuDelegate'

The previous implementation made us lose the keyboard focus each time we set 'localMenuDelegate' to null.
---
 modules/gui/qt/maininterface/qml/BannerSources.qml | 1 +
 modules/gui/qt/maininterface/qml/MainDisplay.qml   | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/maininterface/qml/BannerSources.qml b/modules/gui/qt/maininterface/qml/BannerSources.qml
index 0bc469ced0dd..e5a08b225393 100644
--- a/modules/gui/qt/maininterface/qml/BannerSources.qml
+++ b/modules/gui/qt/maininterface/qml/BannerSources.qml
@@ -340,6 +340,7 @@ FocusScope {
                         onVisibleChanged: {
                             //reset the focus on the global group when the local group is hidden,
                             //this avoids losing the focus if the subview changes
+                            // FIXME: This block needs refactor for keyboard focus.
                             if (!visible && localMenuGroup.focus) {
                                 localMenuGroup.focus = false
                                 globalMenuGroup.focus = true
diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml
index 098ac491dd89..0c6989233b4b 100644
--- a/modules/gui/qt/maininterface/qml/MainDisplay.qml
+++ b/modules/gui/qt/maininterface/qml/MainDisplay.qml
@@ -197,7 +197,6 @@ FocusScope {
                     model: root.tabModel
 
                     onItemClicked: {
-                        sourcesBanner.localMenuDelegate = null
                         var name = root.tabModel.get(index).name
                         selectedIndex = index
                         history.push(["mc", name])
-- 
GitLab