Correct focus handling

pull/6477/head
Henriette Dinger 6 years ago
parent 615c362d25
commit b0b28c3bcf
  1. 5
      app/assets/javascripts/forums.js
  2. 2
      app/views/messages/_form.html.erb

@ -32,7 +32,7 @@
function quoteResult(result) { function quoteResult(result) {
var reply = $("#reply"), var reply = $("#reply"),
subject = $("#reply_subject"), subject = $("#reply_subject"),
content = $("#reply_content"); focusElement = jQuery("#reply #message-form");
subject.val(result.subject); subject.val(result.subject);
@ -43,10 +43,9 @@
}); });
reply.slideDown(); reply.slideDown();
content.focus();
$('html, body').animate({ $('html, body').animate({
scrollTop: content.offset().top scrollTop: focusElement.offset().top
}, 1000); }, 1000);
} }

@ -29,7 +29,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= error_messages_for 'message' %> <%= error_messages_for 'message' %>
<% replying ||= false %> <% replying ||= false %>
<div class="form--field"> <div class="form--field">
<%= f.text_field :subject, required: true, container_class: '-wide' %> <%= f.text_field :subject, required: true, container_class: '-wide', autofocus: true %>
</div> </div>
<% unless replying %> <% unless replying %>
<div class="form--field"> <div class="form--field">

Loading…
Cancel
Save