Commit 88aca84280a050cbcb4aeb1ca6adf69b2a2c76ad:
autofocus
Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>
------------------------------------------------------------
views/add-comment.js.rb | +++++++
------------------------------------------------------------
7 changes: 7 additions, 0 deletions.
------------------------------------------------------------
diff --git a/views/add-comment.js.rb b/views/add-comment.js.rb
index f44b4a4..3a0e5ff 100644
--- a/views/add-comment.js.rb
+++ b/views/add-comment.js.rb
@@ -38,6 +38,13 @@ def render
end
end
+ # autofocus on comment form
+ def componentDidMount()
+ jQuery('#comment-form').on 'shown.bs.modal' do
+ ~'#comment-text'.focus()
+ end
+ end
+
# enable/disable save when input changes
def input(event)
@save_disabled = ( event.target.value.length == 0 )