popupMenu: Don't handle key events for insensitive source

Generalizing menu toggling via keyboard in commit 1d58ea25ab
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
This commit is contained in:
Florian Müllner 2017-03-25 03:26:06 +01:00
parent 6ab045b9ad
commit 647c8df12f

View File

@ -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: