On Jun 12, 2008, at 5:08 PM, Sergiu Dumitriu wrote:
vmassol (SVN) wrote:
Author: vmassol
Date: 2008-06-12 10:08:57 +0200 (Thu, 12 Jun 2008)
New Revision: 10278
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/templates/
login.vm
Log:
XWIKI-2458: Ensure that the username field has the input focus in
the login form so that it's easier for users to quickly log in
Idea submitted by Mihail Agafonovs
Modified: xwiki-platform/web/trunk/standard/src/main/webapp/
templates/login.vm
===================================================================
--- xwiki-platform/web/trunk/standard/src/main/webapp/templates/
login.vm 2008-06-12 03:17:43 UTC (rev 10277)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/templates/
login.vm 2008-06-12 08:08:57 UTC (rev 10278)
@@ -42,5 +42,11 @@
#xwikimessageboxend()
</form>
</div>
+## Ensure that the username field of the login form has the focus
to make it easy for users to log in quickly
+<script type="text/javascript">
+//<![CDATA[
+ document.forms.loginForm.j_username.focus();
+//]]>
+</script>
#template("endpage.vm")
#end
I don't like it. This is intrusive Javascript. I'd rather:
- add a class attribute, class="autofocus"
- write a global SkinExtension that focuses the first element with
that class, if it exists
- and execute that method onload, with Event.observe(window, "load",
autofocus)
Actually before doing this I checked other vm files and I saw this was
a common practice... So common but not good I guess :)
I'm not sure why we would use a skin extension for a template. This is
not about extending a skin, it's about common templates to all skins.
I'd like to understand how the full current template structure is
impacted by the new Skin Extension and what's the vision. Also AFAIK
SkinExtensions are in wiki pages. I don't think it's a good idea to
have pages for template stuff since template stuff work without a
database. The solution you highlight also sounds very slow for
performances.
What's missing now: global skin extensions
don't work yet. We could,
for the moment, pull it in.
WDYM by "pull it in"?
Thanks
-Vincent