Autofocus password, not name, if name is prefilled
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 21 Aug 2009 21:35:52 +0000 (21:35 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 21 Aug 2009 21:35:52 +0000 (21:35 +0000)
includes/templates/Userlogin.php

index 7a17300..5a4d3f9 100644 (file)
@@ -41,9 +41,10 @@ class UserloginTemplate extends QuickTemplate {
                                'id' => 'wpName1',
                                'tabindex' => '1',
                                'size' => '20',
-                               'required',
-                               'autofocus'
-                       ) ); ?>
+                               'required'
+                               # Can't do + array( 'autofocus' ) because + for arrays in PHP
+                               # only works right for associative arrays!  Thanks, PHP.
+                       ) + ( $this->data['name'] ? array() : array( 'autofocus' => '' ) ) ); ?>
 
                        </td>
                </tr>
@@ -56,7 +57,7 @@ class UserloginTemplate extends QuickTemplate {
                                'id' => 'wpPassword1',
                                'tabindex' => '2',
                                'size' => '20'
-                       ) ); ?>
+                       ) + ( $this->data['name'] ? array( 'autofocus' ) : array() ) ); ?>
 
                        </td>
                </tr>