{"action":"created","issue":{"url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/681","repository_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations","labels_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/681/comments","events_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/681/events","html_url":"https://github.com/DavyJonesLocker/client_side_validations/issues/681","id":188282582,"number":681,"title":"Error labels is not appended to an Input with Autofocus and Turbolinks.","user":{"login":"eozelius","id":4130683,"avatar_url":"https://avatars.githubusercontent.com/u/4130683?v=3","gravatar_id":"","url":"https://api.github.com/users/eozelius","html_url":"https://github.com/eozelius","followers_url":"https://api.github.com/users/eozelius/followers","following_url":"https://api.github.com/users/eozelius/following{/other_user}","gists_url":"https://api.github.com/users/eozelius/gists{/gist_id}","starred_url":"https://api.github.com/users/eozelius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eozelius/subscriptions","organizations_url":"https://api.github.com/users/eozelius/orgs","repos_url":"https://api.github.com/users/eozelius/repos","events_url":"https://api.github.com/users/eozelius/events{/privacy}","received_events_url":"https://api.github.com/users/eozelius/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-09T15:58:55Z","updated_at":"2016-11-10T15:07:08Z","closed_at":"2016-11-10T15:07:07Z","body":"Hello, I hope you are all well.\r\n\r\nI am having an bizarre issue with turbolinks, client_side_validations and the Autofocus property.  When I use both libraries, and the autofocus property on a text input, the first time the page loads, (from a turbolinks link) the error message is not being appended to the input.  If you refresh the page, the message will properly be appended to the input.\r\n\r\n`<%= f.text_field :name, class: 'form-control', autofocus: true %>`\r\n\r\nwhen I add the autofocus property, the message is not being appended to the input, the input is wrapped in the `<div class=\"field-with-errors>`, but the label is not appended to the input.  If you try to submit the form, it will not submit until you have passed the validation\r\n\r\nThe rest of the inputs are working well.\r\n\r\nHere is the weird part, this issue resolves itself if you refresh the page.  I have had a handful of weird issues with turbolinks, and overlapping JS/CSS, but this one has be stumped.\r\n\r\nturbolinks version: 5.0.1\r\nclient_side_validation version: 4.2.7\r\nrails version: 4.2.7.1\r\nruby version: 2.3.1p112\r\nOccurs in all browsers on all OS's\r\n\r\nIssue can be observed at rndev.mcfinternal.com, \r\n1. select any of the Notes\r\n2. you will be forwarded to a form, the validations don't work for the Recipient Name field (autofocus is enabled), but they work for the rest of the fields.\r\n3. Refresh the page, the validations will now work for Recipient Name"},"comment":{"url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/comments/259713657","html_url":"https://github.com/DavyJonesLocker/client_side_validations/issues/681#issuecomment-259713657","issue_url":"https://api.github.com/repos/DavyJonesLocker/client_side_validations/issues/681","id":259713657,"user":{"login":"tagliala","id":556268,"avatar_url":"https://avatars.githubusercontent.com/u/556268?v=3","gravatar_id":"","url":"https://api.github.com/users/tagliala","html_url":"https://github.com/tagliala","followers_url":"https://api.github.com/users/tagliala/followers","following_url":"https://api.github.com/users/tagliala/following{/other_user}","gists_url":"https://api.github.com/users/tagliala/gists{/gist_id}","starred_url":"https://api.github.com/users/tagliala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tagliala/subscriptions","organizations_url":"https://api.github.com/users/tagliala/orgs","repos_url":"https://api.github.com/users/tagliala/repos","events_url":"https://api.github.com/users/tagliala/events{/privacy}","received_events_url":"https://api.github.com/users/tagliala/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T15:07:07Z","updated_at":"2016-11-10T15:07:07Z","body":"Sorry, cannot confirm.\r\n\r\nGemfile\r\n```rb\r\ngem 'client_side_validations'\r\ngem 'rails', '4.2.7.1'\r\ngem 'turbolinks'\r\n```\r\n\r\nGemfile.lock\r\n```\r\n    rails (4.2.7.1)\r\n      actionmailer (= 4.2.7.1)\r\n      actionpack (= 4.2.7.1)\r\n      actionview (= 4.2.7.1)\r\n      activejob (= 4.2.7.1)\r\n      activemodel (= 4.2.7.1)\r\n      activerecord (= 4.2.7.1)\r\n      activesupport (= 4.2.7.1)\r\n      bundler (>= 1.3.0, < 2.0)\r\n      railties (= 4.2.7.1)\r\n      sprockets-rails\r\n    client_side_validations (4.2.7)\r\n      jquery-rails (>= 3.1.2, < 5.0.0)\r\n      js_regex (~> 1.0, >= 1.0.9)\r\n      rails (>= 4.0.0, < 4.3.0)\r\n    turbolinks (5.0.1)\r\n      turbolinks-source (~> 5)\r\n```\r\n\r\nroutes\r\n```rb\r\n  get :turbolinks, to: 'posts#turbolinks'\r\n  resources :posts, only: [:new, :create]\r\n```\r\n\r\nModel\r\n```rb\r\nclass Post < ActiveRecord::Base\r\n  validates :email, presence: true\r\nend\r\n```\r\n\r\napplication.js\r\n```js\r\n//= require jquery\r\n//= require jquery_ujs\r\n//= require turbolinks\r\n//= require rails.validations\r\n//= require_tree .\r\n```\r\n\r\n/app/views/posts/turbolinks.html.erb\r\n```rb\r\n<%= link_to 'New Post', new_post_path %>\r\n```\r\n\r\n/app/views/posts/new.html.erb\r\n```rb\r\n<%= form_for @post, validate: true do |f| %>\r\n  <%= f.label :email %>\r\n  <%= f.email_field :email, autofocus: true %>\r\n\r\n  <%= f.submit %>\r\n<% end %>\r\n```\r\n\r\n1. Open `localhost:3000/turbolinks`\r\n![image](https://cloud.githubusercontent.com/assets/556268/20181633/3dffacb8-a75f-11e6-972c-2496fc50bfb1.png)\r\n\r\n2. Click on `New Post`, making sure it performs an xhr request\r\n![image](https://cloud.githubusercontent.com/assets/556268/20181700/76cb22ca-a75f-11e6-816f-222eb6111077.png)\r\n\r\n3. Check that autofocus is working\r\n![image](https://cloud.githubusercontent.com/assets/556268/20181717/8afeeeac-a75f-11e6-9504-8dec9334eeb4.png)\r\n\r\n4. Blur field (I've used tab) and make sure CSV adds an error\r\n![image](https://cloud.githubusercontent.com/assets/556268/20181739/a18f9036-a75f-11e6-8d98-f215219203fc.png)\r\n"}}
{"actor":{"display_login":"tagliala"}}