[gnome-shell/wip/fmuellner/grabby-language-menu: 2/3] popupMenu: Respect items' :can-focus property



commit 24a26e025b65494f8a83f22e0876b52287380ea8
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Sep 11 17:55:36 2018 +0200

    popupMenu: Respect items' :can-focus property
    
    Menu items use a single 'active' state that follows both hover and
    keyboard focus. It therefore makes sense for the active item to always
    grab the focus, in particular as an item that is sensitive but not
    focusable by keynav would be rather weird.
    
    As it turns out, we do have a case that is weird enough where we want
    exactly that, so only grab focus if the actor's :can-focus property
    allows it.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/171

 js/ui/popupMenu.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 843af8223..283934c28 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -173,7 +173,8 @@ var PopupBaseMenuItem = class {
             this.active = active;
             if (active) {
                 this.actor.add_style_class_name('selected');
-                this.actor.grab_key_focus();
+                if (this.actor.can_focus)
+                    this.actor.grab_key_focus();
             } else {
                 this.actor.remove_style_class_name('selected');
                 // Remove the CSS active state if the user press the button and


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