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

@ -29,7 +29,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= error_messages_for 'message' %>
<% replying ||= false %>
<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>
<% unless replying %>
<div class="form--field">

Loading…
Cancel
Save