Fork me on GitHub
#re-frame
<
2017-06-06
>
reefersleep06:06:04

@jkrasnay out of curiousity, how do you check if it "is the latest"? I've had a bit of trouble applying focus to an element myself, in my case it was the text input of a modal popup. Managed to fix it, but eager to learn more helpful bits 🙂

mikethompson09:06:59

Checking: would setting the :auto-focus "true" attribute on an input when it is first rendered do the job?

ronb10:06:58

@sandbags This happens if either the js runtime is busy and cannot evaluate the code before the figwheel timeout or if you try to print too much on the console, when refering to an atom it tries to print the complete state of that atom if i remember correctly

sandbags14:06:19

hrmmm.... unless something went very wrong (which is of course most likely the case) the atom should have almost nothing in it ... hrmm

sandbags14:06:26

thanks anyway for the info

reefersleep15:06:19

@mikethompson : I'll check it later, my I left my solution at home and in a bit of a messy state.

jkrasnay20:06:49

@reefersleep @mikethompson I keep an attribute :selected-field in my app-db. Usually it’s driven off the focus and blur events on the fields, but in this case I set it when I add the field and use it to drive the focus. :auto-focus "true" is a neat idea, though. I’ll give it a try.

mikethompson22:06:42

@jkrasnay just to be clear: auto-focus only works as a way to get initial focus to an <input>. By initial focus, I mean focus when first rendered. You can't subsequently fiddle with auto-focus (set it back to false, and then back to true again) in an attempt to "switch" focus from one <input> to the next