I am coding an app using jQuery, jqTouch and phonegap and have run across a persistent problem which arises when a user submits a form using the Go button on the soft keyboard.
Although it is easy to get the cursor to move to the appropriate form input element by using $('#input_element_id').focus()
, the orange outline highlight always returns to the last input element on the form. (The highlight does not show up when the form is submitted using the form submit button.)
What I need is to find a way either to disable the orange highlight completely or else make it move to the same input element as the cursor.
So far, I have tried adding the following to my CSS:
.class_id:focus {
outline: none;
}
This works in Chrome but not on the emulator or on my phone. I have also tried editing the jqTouch theme.css
to read:
ul li input[type="text"] {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); and
-webkit-focus-ring-color: rgba(0, 0, 0, 0);
}
With no effect.
I have also tried each of the following additions to the AndroidManifest.xml
file:
android:imeOptions="actionNone"
android:imeOptions="actionSend|flagNoEnterAction"
android:imeOptions="actionGo|flagNoEnterAction"
None of which have any effect.
Update: I have done some more troubleshooting with this and to date have found:
The outline property works only on Chrome, not on the Android browser.
The
-webkit-tap-highlight-color
property does in fact work on the Android browser, though not on Chrome. It disables the highlight on focus as well as on tapping.The
-webkit-focus-ring-color
property does not seem to work on either browser.
Be aware that using this CSS
-webkit-user-modify: read-write-plaintext-only;
WILL remove that horrible highlight 'bug' - BUT it may kill your devices ability to provide a specific keyboard. For us running Android 4.0.3 on a Samsung Tab 2, we could no longer get the numeric keyboard. Even using type='number' &/or type='tel' . Very frustrating! BTW, setting tap highlight colour did nothing to resolve this issue for this device and OS config. We are running Safari for android.I just wanted to share my experience. I didn't really get this to work, and I wanted to avoid the slow css-*. My solution was to download good old Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) and add this one to my phonegap project. I then added:
In my experience this is a faster approach to the *, but it is also an approach to less weird bugs. Combination of tap-highlight, -webkit-user-modify: read-write-plaintext-only and disabling of for example text highlighting have provided us with a lot of headaces. One of the worst being that suddenly keyboard input stops working and slow keyboard visualization.
Complete CSS-reset with the orange highlight disabled:
Try following code that disable border outline
in your css file. It worked for me !
Try for Focus Line
This will work not only for taps, but hover as well: