Js focus value fix

Fix for JS value settings and for a focus on top of #994 and #980, also fixes #987