{"id":19,"date":"2008-09-12T10:29:14","date_gmt":"2008-09-12T09:29:14","guid":{"rendered":"http:\/\/www.weeklywhinge.com\/?p=19"},"modified":"2008-09-12T10:29:14","modified_gmt":"2008-09-12T09:29:14","slug":"google-chrome-bug-in-onchange-on-select-dropdown","status":"publish","type":"post","link":"https:\/\/www.weeklywhinge.com\/?p=19","title":{"rendered":"Google Chrome bug in onchange on select dropdown"},"content":{"rendered":"<p>So a classic web developer trick is to use the onchange event of a dropdown to change another field in the form. Yes, there are accessibility issues with this (keyboard+screenreader users could trigger the onchange event while scrolling through the options) but FF3 and WebKit both seem to have realised this and if you change the value keyboard-wise they only trigger onchange when you blur. Of course IE7 is behind the curve on this (surprise) but with luck IE8 might catch up.<\/p>\n<p>Anyway, Chrome seems to have a problem with setting focus() to another object from within the onchange event &#8211; while the focus works fine and the new field is focussed correctly, it fails to update the existing selectbox to the new value.<\/p>\n<p>There is a workaround (of course) and it&#8217;s fairly straightforward: replace<\/p>\n<pre>linkedField.focus();<\/pre>\n<p>with<\/p>\n<pre>setTimeout(function (){linkedField.focus()}, 5);<\/pre>\n<p>and all is fine.<\/p>\n<p>Safari doesn&#8217;t exhibit this so I don&#8217;t know if it&#8217;s something google has done or if it&#8217;s just Safari&#8217;s more recent webkit version. Let&#8217;s hope that it&#8217;s fixed before the beta period ends!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So a classic web developer trick is to use the onchange event of a dropdown to change another field in the form. Yes, there are accessibility issues with this (keyboard+screenreader users could trigger the onchange event while scrolling through the options) but FF3 and WebKit both seem to have realised this and if you change [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-webdev"],"_links":{"self":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":1,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}