How can one use setFocus?

Oops, forgot to include the mailing list as a recipient... Fixed now! :-)

---------- Forwarded message ----------
From: Helder Magalhães <helder.magalhaes@gmail.com>
Date: Thu, Jun 12, 2008 at 6:08 PM
Subject: Re: How can one use setFocus?
To: Jonathan Chetwynd <j.chetwynd@btinternet.com>


> How can one use setFocus?

Did you mean something like the attached file?

Transcript of file comment, set as "desc" element, (implementation
details can be seen in the file source itself):

«
       Sample usage of setFocus [1].
       Motivated by a SVG mailing list [2] post [3].
       Setting the "focusable" attribute [4] in the target text field
is part of the task as a visible caret is intended (see the original
post [3]).

       Seems to works in Opera 9.50.
       Known _not_ to work in Firefox 2/3, Opera 9.2x, ASV 3/6, Batik 1.7.

       Note that, although ASV 6 supports the "editable" property, it
doesn't recognize "setFocus". Also, "editable" is only recognized when
set to "true" (as a deprecated version of the SVG specification [5]
seems to have been used to implement this feature), which _will_ break
compliant implementations (such as Opera)!
       Finally, "another editable text field" was only added to ease
comparison and to somehow test implementation quality (it's not
required to achieve desired behavior).

       [1] http://www.w3.org/TR/SVGMobile12/interact.html#focus-api
       [2] http://lists.w3.org/Archives/Public/www-svg/
       [3] http://lists.w3.org/Archives/Public/www-svg/2008Jun/0022.html
       [4] http://www.w3.org/TR/SVGMobile12/interact.html#FocusableAttribute
       [5] http://www.w3.org/TR/2004/WD-SVG12-20041027/text.html
»

While creating this sample, I was amazed by Opera (version 9.5)
improvements on this subject. One may easily see some in action [6]
(when using that browser version). Good work Opera team! ;-)

Hope this helps,

 Helder Magalhães

[6] http://www.w3.org/TR/SVGMobile12/examples/focusHighlight.svg

Received on Monday, 16 June 2008 08:47:14 UTC