The user_login form is the only form in Drupal core that defines a tabindex attribute:
function user_login(&$form_state) {
...
$form['name'] = array('#type' => 'textfield',
'#title' => t('Username'),
...
'#attributes' => array('tabindex' => '1'),
);
$form['pass'] = array('#type' => 'password',
'#title' => t('Password'),
...
'#attributes' => array('tabindex' => '2'),
);
...
$form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2, '#attributes' => array('tabindex' => '3'));
return $form;
}
Specifying the tabindex is however not required as the natural order of the fields (username, password, submit) in the markup already provides the desired usability/accessibility.
Moreover, the presence of the tabindex makes it a bit unnecessary hard/messy to add an accessible CAPTCHA element between the password field and submit button: #128550: Tab Key on User Login Form passowrd field jumps to 'submit' button instead of captcha field. I guess there are other cases of form_altering that suffer from the same problem.
The attached patch removes the tabindex attributes from the user_login form.
Comment | File | Size | Author |
---|---|---|---|
#3 | remove_tabindex_D6.patch | 1.12 KB | soxofaan |
remove_tabindex.patch | 1.1 KB | soxofaan | |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedInteresting bit of history, lying there. Those should obviously go away.
Comment #2
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #3
soxofaan CreditAttribution: soxofaan commentedThanks,
any chance the backport for D6 can get in?
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedI support the backport too. It shouldn't hurt.
Comment #5
Gábor HojtsyWell, I guess you could have altered the tabindex just as well. Anyway, makes sense to commit to Drupal 6 too. Done!