← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/tag-input-has-focus-during-edit into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/tag-input-has-focus-during-edit into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1107811 in Launchpad itself: "Clicking "Add tags" or "Edit tags" doesn't focus the tags field"
  https://bugs.launchpad.net/launchpad/+bug/1107811

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/tag-input-has-focus-during-edit/+merge/145526

Shift the removeClass(HIDDEN) before we instruct the tag_input to get focus.
-- 
https://code.launchpad.net/~stevenk/launchpad/tag-input-has-focus-during-edit/+merge/145526
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/tag-input-has-focus-during-edit into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bug_tags_entry.js'
--- lib/lp/bugs/javascript/bug_tags_entry.js	2012-09-05 23:06:42 +0000
+++ lib/lp/bugs/javascript/bug_tags_entry.js	2013-01-30 01:18:22 +0000
@@ -141,8 +141,8 @@
     populate_tags_input();
     tag_list_span.addClass(HIDDEN);
     tags_trigger.addClass(HIDDEN);
+    tags_form.removeClass(HIDDEN);
     tag_input.focus();
-    tags_form.removeClass(HIDDEN);
     autocomplete.render();
 };
 

=== modified file 'lib/lp/bugs/javascript/tests/test_bug_tags_entry.js'
--- lib/lp/bugs/javascript/tests/test_bug_tags_entry.js	2012-10-26 10:00:20 +0000
+++ lib/lp/bugs/javascript/tests/test_bug_tags_entry.js	2013-01-30 01:18:22 +0000
@@ -85,7 +85,6 @@
             Y.Assert.isInstanceOf(Y.Node, form_node.one('#tag-input'));
             Y.Assert.isInstanceOf(Y.Node, form_node.one('#tags-edit-spinner'));
             Y.Assert.isInstanceOf(Y.Node, form_node.one('#edit-tags-cancel'));
-            Y.Assert.isInstanceOf(Y.Node, form_node.one('#tag-input'));
             Y.Assert.isInstanceOf(Y.Node, Y.one('.bug-tag-complete'));
         },
 
@@ -144,6 +143,11 @@
             Y.Assert.isFalse(this.tags_form.hasClass('hidden'));
             Y.Assert.isFalse(this.ok_button.hasClass('hidden'));
             Y.Assert.isFalse(this.cancel_button.hasClass('hidden'));
+            // Check the tag-input has focus.
+            var form_node = this.bug_tags_div.one('#tags-form');
+            var tag_input = form_node.one('#tag-input');
+            var focused_element = Y.one(document.activeElement);
+            Y.Assert.areEqual(focused_element, tag_input);
         },
 
         test_cancel: function() {