Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submit button not focused even though tabindex is properly set

I have defined tab index for the input fields in a form. When tabbing through the input fields the submit button is never getting the focus, some other input fields in a different form on the page gets the focus. Those are all having tab indexes higher than 3. How come?

<form action="subscription.php" name="subscribe" method="post"  onsubmit="return isValidEmailAndEqual()">
<p id="formlabel">E-mail</p> <input type="text" name="email1" tabindex=1>

<br/>
<p id="formlabel">Repeat e-mail</p> <input type="text" name="email2" tabindex=2> <br/>
<input id="inputsubmit" type="submit" value="Subscribe" tabindex=3>
</form>

CSS:

input {
    background-color : #333;
    border: 1px solid #EEE;
    color: #EEE;
    margin-bottom: 6px;
    margin-top: 4px;
    padding: 1px;
    width : 200px;
}

#inputsubmit {
    background-color : #d7e6f1;
    border: 1px solid #EEE;
    color: #0000ff;
    margin-bottom: 6px;
    margin-top: 4px;
    padding: 1px;
    width : 200px;
}

#inputsubmit:hover {
    cursor: pointer; cursor: hand;  
    background-color : #d7e6f1;
    border: 1px solid #0000ff;
    color: #0000ff;
    margin-bottom: 6px;
    margin-top: 4px;
    padding: 1px;
    width : 200px;
}

p#formlabel{
    width: 100;
}
like image 609
Nicsoft Avatar asked Feb 25 '10 14:02

Nicsoft


1 Answers

This is a Mac OS X issue. Your Mac may be configured to not allow you to tab to non-textfield elements (e.g., buttons). You can change this by going into system preferences for keyboard. Then click on the shorcut tab and look at the bottom and choose the option to allow focus on all controls. You should now be able to focus on the buttons on Safari and Firefox in addition to all buttons in Mac OS.

To quickly change the setting on your Mac, press CTRL + F7 (or if you're using a Mac Keyboard, try holding down the Function Key and pressing CTRL + F7).

like image 186
Rick Avatar answered Oct 13 '22 01:10

Rick