Index: gtk/gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.579
diff -u -p -r1.579 gtktreeview.c
--- gtk/gtktreeview.c	16 Nov 2006 12:56:30 -0000	1.579
+++ gtk/gtktreeview.c	23 Nov 2006 13:54:22 -0000
@@ -9576,6 +9576,8 @@ gtk_tree_view_move_cursor_up_down (GtkTr
         }
     }
 
+  gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+
   if (new_cursor_node)
     {
       cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
@@ -9585,10 +9587,27 @@ gtk_tree_view_move_cursor_up_down (GtkTr
   else
     {
       gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
-      gtk_widget_error_bell (GTK_WIDGET (tree_view));
-    }
 
-  gtk_widget_grab_focus (GTK_WIDGET (tree_view));
+      if (!tree_view->priv->shift_pressed)
+        {
+          if (! gtk_widget_keynav_failed (GTK_WIDGET (tree_view),
+                                          count < 0 ?
+                                          GTK_DIR_UP : GTK_DIR_DOWN))
+            {
+              GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tree_view));
+
+              if (toplevel)
+                gtk_widget_child_focus (toplevel,
+                                        count < 0 ?
+                                        GTK_DIR_TAB_BACKWARD :
+                                        GTK_DIR_TAB_FORWARD);
+            }
+        }
+      else
+        {
+          gtk_widget_error_bell (GTK_WIDGET (tree_view));
+        }
+    }
 }
 
 static void
