[Ur] Grabbing focus
Edward Z. Yang
ezyang at MIT.EDU
Thu May 17 14:23:13 EDT 2012
Excerpts from Adam Chlipala's message of Thu May 17 08:50:51 -0400 2012:
> 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.
Unfortunately, it's not clear if "on creation" is well defined or
has the desired semantics. If I generate an XML fragment but don't
put it on the page, it shouldn't grab focus.
> What would be a usual way of implementing this in HTML/JavaScript?
Let 'el' be a DOMElement that is focusable, then you can focus it
by doing 'el.focus()'.
Cheers,
Edward
More information about the Ur
mailing list