Commit 661fc11c29059d8dc109ddacfb5313450bad1d12

Authored by Antonio Terceiro
2 parents fb147d67 1941721b

Merge branch 'fix_focus_comment' into 'master'

 Fix focus in input field when clicked on post a comment

See merge request !350
plugins/require_auth_to_comment/public/hide_comment_form.js
1 1 (function($) {
2 2 $(window).bind('userDataLoaded', function(event, data) {
3 3 if (data.login || $('meta[name="profile.allow_unauthenticated_comments"]').length > 0) {
4   - $('.post-comment-button').livequery(function() {
5   - $(this).show();
6   - });
7   - $('.page-comment-form').livequery(function() {
8   - $(this).show();
9   - });
10   - $('.comment-footer').livequery(function() {
  4 + $('.post-comment-button, .page-comment-form, .comment-footer, .display-comment-form').livequery(function() {
11 5 $(this).show();
12 6 });
13 7 }
... ...
plugins/require_auth_to_comment/public/style.css
1   -.post-comment-button, .page-comment-form, .comment-footer {
  1 +.post-comment-button, .page-comment-form, .comment-footer, .display-comment-form {
2 2 display: none;
3 3 }
... ...
public/javascripts/comment_form.js
... ... @@ -3,7 +3,7 @@ jQuery('.display-comment-form').click(function(){
3 3 var $button = jQuery(this);
4 4 toggleBox($button.parents('.post_comment_box'));
5 5 jQuery($button).hide();
6   - $button.closest('.page-comment-form').find('input').first().focus();
  6 + $button.closest('.page-comment-form').find('input[type="text"]:visible,textarea').first().focus();
7 7 return false;
8 8 });
9 9  
... ...