+ Dragging a tab now causes it to become the focused tab.
authorAza Raskin <aza@mozilla.com>
Thu, 13 May 2010 14:11:31 -0700
changeset 49875 55b902647dee622f00d507edfe08c0d26ba5164b
parent 49874 07f99d8fe249813a6dc0ffa9d05edef0695c72ca
child 49879 c0eea763394f85c62300186a95911d0acf0a0a7b
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
+ Dragging a tab now causes it to become the focused tab. + Hitting return in a name field no longer causes the focused tab to zoom in
browser/base/content/tabcandy/app/groups.js
browser/base/content/tabcandy/app/ui.js
--- a/browser/base/content/tabcandy/app/groups.js
+++ b/browser/base/content/tabcandy/app/groups.js
@@ -968,23 +968,31 @@ var DragInfo = function(element, event) 
   
   this.$el.data('isDragging', true);
   this.item.setZ(99999);
 };
 
 DragInfo.prototype = {
   // ----------  
   snap: function(event, ui){
-    window.console.log( event, ui);
+    //window.console.log( event, ui);
     // Step 1: Find the closest group by edge
     
     // Step 2: Match to the to
     
   },
   
+  // ----------
+  start: function() {
+    // When a tab drag starts, make it the focused tab.
+    if( !this.item.isAGroup ){
+      Page.setActiveTab(this.item);
+    }    
+  },
+  
   // ----------  
   drag: function(event, ui) {
     if(this.item.isAGroup) {
       var bb = this.item.getBounds();
       bb.left = ui.position.left;
       bb.top = ui.position.top;
       this.item.setBounds(bb, true);
     } else
@@ -1018,16 +1026,17 @@ DragInfo.prototype = {
       
     if(this.item && !this.$el.hasClass('willGroup') && !this.item.parent) {
       this.item.setZ(drag.zIndex);
       drag.zIndex++;
       
       this.item.reloadBounds();
       this.item.pushAway();
     }
+    
   }
 };
 
 var drag = {
   info: null,
   zIndex: 100
 };
 
@@ -1036,16 +1045,17 @@ var drag = {
 // Singelton for managing all <Group>s. 
 window.Groups = {
   // ----------  
   dragOptions: {
     scroll: false,
     cancel: '.close',
     start: function(e, ui) {
       drag.info = new DragInfo(this, e);
+      drag.info.start();
     },
     drag: function(e, ui) {
       drag.info.drag(e, ui);
 
     },
     stop: function() {
       drag.info.stop();
       drag.info = null;
--- a/browser/base/content/tabcandy/app/ui.js
+++ b/browser/base/content/tabcandy/app/ui.js
@@ -192,18 +192,19 @@ window.Page = {
           }
           self.setActiveTab(nextTab);           
         }
         e.preventDefault();               
       }      
     });
     
     $(window).keyup(function(e){
-      // If you hit escape or return, zoom into the active tab.
-      if(e.which == 27 || e.which == 13)
+      // If you hit escape or return, zoom into the active tab,
+      // but only if a title or other element isn't focused.
+      if((e.which == 27 || e.which == 13) && $(":focus").length == 0 )
         if( self.getActiveTab() ) self.getActiveTab().zoom();
     });
   },
     
   // ----------  
   init: function() {
     var self = this;
     Utils.homeTab.raw.maxWidth = 60;