[gnome-shell/50-fix-overview-focus-stealing: 58/58] workspace: Don't move focus unconditionally



commit b196c2b3b35b60815851d9458db7d0e95531f349
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Oct 10 00:04:56 2017 +0200

    workspace: Don't move focus unconditionally
    
    Since commit 1939e22c22c, we move the keyboard focus with the hover
    highlight. However while this makes sense when interacting with
    the window picker, it interferes with keyboard navigation of other
    components like dash or top bar. Address this by only moving the
    focus when the previous focus was already inside the window picker
    or unset.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/50

 js/ui/workspace.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index d049eae61..1e121b778 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -660,7 +660,6 @@ var WindowOverlay = new Lang.Class({
         if (this._hidden)
             return;
 
-        this._windowClone.actor.grab_key_focus();
         this._animateVisible();
         this.emit('show-close-button');
     },
@@ -1852,7 +1851,12 @@ var Workspace = new Lang.Class({
 
         this.actor.add_actor(clone.actor);
 
-        overlay.connect('show-close-button', this._onShowOverlayClose.bind(this));
+        overlay.connect('show-close-button', () => {
+            let focus = global.stage.key_focus;
+            if (focus == null || this.actor.contains(focus))
+                clone.actor.grab_key_focus();
+            this._onShowOverlayClose(overlay);
+        });
 
         if (this._windows.length == 0)
             clone.setStackAbove(null);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]