[gnome-shell] popupMenu: Don't handle key events for insensitive source



commit 647c8df12f73e95864e5e850f259499119d15410
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Mar 25 03:26:06 2017 +0100

    popupMenu: Don't handle key events for insensitive source
    
    Generalizing menu toggling via keyboard in commit 1d58ea25ab6f047
    fixed keynav in many places, but it turns out that it also adds
    unexpected interactions in some cases where the source is not
    button-like, as for example the entry context menus provided by
    ShellEntry. Commit e33c68a415 fixed one case, however it is still
    possible for plain enter/space to unexpectedly trigger the menu
    if the entry itself doesn't consume the event, which is the case
    when ClutterText:editable is false. However for a general fix, it
    makes more sense to consider the source actor's :reactive property
    and disable toggling menus via keyboard when they cannot be toggled
    by pointer either - expecting non-editable entries to be non-reactive
    as well seems like a reasonable assumption, and indeed all our code
    follows that pattern.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758873

 js/ui/popupMenu.js |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 011a95a..d326ea8 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -785,6 +785,11 @@ const PopupMenu = new Lang.Class({
     },
 
     _onKeyPress: function(actor, event) {
+        // Disable toggling the menu by keyboard
+        // when it cannot be toggled by pointer
+        if (!actor.reactive)
+            return Clutter.EVENT_PROPAGATE;
+
         let navKey;
         switch (this._boxPointer.arrowSide) {
             case St.Side.TOP:


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