[gnome-shell/wip/fmuellner/unbreak-wifi-keynav: 113/113] network: Keep key focus in dialog when removing networks



commit b1dd746443a949aaa4a700fec3b2acfa7fb90e36
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Mar 2 23:44:44 2018 +0100

    network: Keep key focus in dialog when removing networks
    
    When the actor that has the key focus is destroyed, Clutter moves
    the focus to the stage. In case the destroyed actor was inside a
    ModalDialog, this breaks any keyboard interaction: keynav is broken
    because the stage isn't in any focus chain, and access keys like
    Escape because they are handled on the dialog's parent.
    
    The only dialog that may destroy a child without recreating the dialog
    buttons (and thus moving the key focus there) is the WirelessDialog,
    fix it by keeping the key focus within the dialog when removing networks
    from the list.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/76

 js/ui/status/network.js | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index a71297eed..bf3a2bac6 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -1164,6 +1164,11 @@ var NMWirelessDialog = new Lang.Class({
             Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor);
             this._selectNetwork(network);
         });
+        network.item.actor.connect('destroy', () => {
+            let keyFocus = global.stage.key_focus;
+            if (keyFocus && keyFocus.contains(network.item.actor))
+                this._itemBox.grab_key_focus();
+        });
     },
 });
 


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