Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Safari not display caret/cursor. #105

Closed
gotnull opened this issue Sep 13, 2012 · 4 comments
Closed

Mobile Safari not display caret/cursor. #105

gotnull opened this issue Sep 13, 2012 · 4 comments

Comments

@gotnull
Copy link

gotnull commented Sep 13, 2012

We have an issue where we've implemented a custom keyboard within a Phonegap application.

First of all we've noticed that the virtual keyboard on this URL when accessed via Mobile Safari does not display a blinking cursor:

http://mottie.github.com/Keyboard/mobile.html

Is this a bug? This is happening with our Phonegap application and we absolutely require the caret/cursor to appear within the input field and require the ability to tap on the input field to place the cursor inbetween words.

This is happening on devices with a target deployment of 4.3 and devices running firmware 5.1.1.

NOTE: We don't want the native keyboard displaying at all so clicking inside the input field is out of the question as this initiates the native keyboard if we don't set the input field to be readonly.

Any help would be greatly appreciated as this has become a blocker for us and we are awaiting a fix before we submit to the AppStore for review.

@gotnull gotnull closed this as completed Sep 13, 2012
@gotnull gotnull reopened this Sep 13, 2012
@Mottie
Copy link
Owner

Mottie commented Sep 13, 2012

Sadly, I think this is an issue with Safari. In the main readme file, I have this posted under "Known Problems"

Safari: See the QWERTY Text Area demo with a locked input. While using the virtual keyboard to type, it enters the text in backwards! This is because textareas with a "readonly" attribute always returns zero for the caret postion.

I did a quick search and maybe this solution to disable the default keyboard might work.

@gotnull
Copy link
Author

gotnull commented Sep 13, 2012

Thought it was a bug. This sucks.

The solution will not help because we're not using a native iPhone application, this is a web application using Phonegap so we can't actually access any UITextField instances.

@gotnull gotnull closed this as completed Sep 13, 2012
@gotnull gotnull reopened this Sep 13, 2012
@raduanastase
Copy link

In the code for the caret jQuery plugin, on line 1726 you get

if (ss) {
    s = t.selectionStart;
    e = t.selectionEnd;
}

you should replace that with

if (ss) {
    s = $(t).val().length;
    e = $(t).val().length;
}

to force the caret position to the last available position.
This is not an elegant solution and it interferes with the working caret positioning, but that didn't bother me for now.

@Mottie
Copy link
Owner

Mottie commented Mar 7, 2015

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue this discussion.

@Mottie Mottie closed this as completed Mar 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants