[Ur] Grabbing focus

Adam Chlipala adamc at impredicative.com
Thu May 17 08:50:51 EDT 2012


Edward Z. Yang wrote:
> I have a<dyn>  region which at some points in time has a<ctextbox>.  What I
> would like is when some code creates the textbox, I would also like it to grab
> focus.  Now, I know I can do this with the FFI, but it would be nice if there
> was a principled way to do this from Ur/Web.  One may might be to augment the
> indexes of the tag constructor; another way might be to add a new
> meta-attribute which takes some sort of source and detects when false->true
> transitions occur.  One thing to think about is what to do when multiple
> things show up and want focus; it's not a very modular way of acting.

What about a pseudo-attribute (of type [bool] or [unit]) for focus-able 
elements, asking to give them focus upon creation?  Maybe this is your 
first suggestion above.

What would be a usual way of implementing this in HTML/JavaScript?



More information about the Ur mailing list