I have a webview into my Android app. My html has a textarea and I want to know when the user hides the keyboard with the android back button.
On Titanium the android:back event doesn't work, it isn't fired when the keyboard is hided.
And the blur() event doesn't work too because when the keyboard is hided the textarea doesn't lose the focus.
Please help. Thank you.
You can use androidback on any Ti.UI.Window or Ti.UI.TabGroup top-level container. It was called android:back until 3.0.0. And for the blur() event, you can use the Ti.UI.Android.hideSoftKeyboard() method.
Related
I'm trying to set focus and place the cursor in a text box and bring up the keyboard automatically when I pop up a modal dialog. I don't want the user to click anywhere. This works fine everywhere except on mobile Safari.
I tried focus(), touchstart, timeouts, direct and indirect event generation, etc. with jQuery with no luck. Does anyone have any ideas?
Try to generate a click event after setting the focus
As the title says, Android Talkback is not registering the onFocus event. I understand that the onFocus event is not ever registered since the screen reader is using a special type of accessibility focus. How, then, can we drive/manipulate the accessibility focus to provide the user a better experience?
I have an example here: https://codesandbox.io/s/r54j2mqrl4 . So here the console.log("hello!") is not registering for me in mobile Android Talkback, however it is registering correctly on desktop mac OSX(with no screen reader on). I am using the tab key to navigate.
Is there something similar to an onFocus event to use for Android Talkback's accessibility focus?
Thank you in advance for your time.
Device and versions:
Mobile Android Talkback: Samsung Galaxy Tab S2, Android version 7.0, Google Chrome 62.0.3202.84
Desktop Mac OSX: macOS Sierra 10.12.6, Google Chrome 61.0.3163.100
The ".focus()" method theoretically should work. The problem would come into play in the event that the thing that was receiving "focus" would not also receive accessibility focus. An Android Accessibility Service can only accessibility focus things that are also Accessibility focusable.
Unfortunately you cannot manipulate Accessibility Focus directly from Javascript, only focus. This being said, when you're in Android and something requests focus, this usually suggests accessibility focus will also move to that item along with focus. In TalkBack terms, this is how Tab navigation works, Accessibility Focus just follows input focus around. It's not perfect, but it's a reasonable expectation that Focus and Accessibility Focus want to be the same. Though not always: EditTexts can be in an quazi focused/unfocused state in TalkBack, for good reason... you may need to interact with the onscreen keyboard while the field still has the cursor (input focus).
If the following is true:
Your Element is Accessibility Focusable
Your element is focusable
The thing that is A11yFocusable and the thing that is focusable are the same, and not just descendants (very important).
You can easily confirm the above three things by exploring in Android Device monitor. Triple check that you aren't focusing something (like a child of the element) of the thing that you are envision getting accessibility focus.
If, after that, you call .focus() on the thing, and it doesn't work, you have essentially found a bug in the webview you are using to render your HTML/Javascript content, and no there is nothing you can do about it.
we are developing an application which is both mobile and desktop, when we use .focus() on the mobile version the keyboard is not showing up, we try by triggering a click within the focus function $('#numeroCheque').focus(function(){
$('#numeroCheque').trigger('click');
});
but still no keyboard is shown, does anyone faced this issue before, and what can we do to solve it. Thanks.
As I understand, you can't set the focus to an input element programmatically on mobile. There needs to be some kind of user interaction. If building out a Cordova application, you can disable this using the KeyboardDisplayRequiresUserAction setting in your config file. But that is only if you wish to wrap your application in Cordova.
ref: https://cordova.apache.org/docs/en/2.7.0/guide/project-settings/ios/
The other option is to set the input element attribute autofocus but even this I believe won't work on mobile either.
make sure your keyboard element has native support for keyboard interaction and that the element can receive keyboard focus across different platforms.
also make sure the tabindex attribute of .focus() is correct.
Focusing is not enough, you need a click event to trigger focus, and wait until the page is fully loaded.
$(document).ready(function() {
$('#numeroCheque').click(function(e){
$(this).focus();
});
});
I have a <textarea> inside of an Ext.list in a web application that I'm viewing on iOS in a UIWebView.
When the <textarea> is focused and the keyboard is up, if I click anywhere in the UIWebView, then the <textarea> blurs and the keyboard moves down. Again, mobile safari does not do this, leading me to believe that this is behavior produced by Sencha Touch, and I would like to get rid of it. I'd like the user to be able to interace with web content while the keyboard is up.
I registered to event listeners - ontouchstart on the ext.list, and onbluron the <textarea>. The fact that, when the <textarea> is focused, if I click on ext.list, the ontouchstart fires before the onblur, I am lead to believe that UIWebView is not blurring the field, but something in Sencha Touch definitely seems to be also registering some sort of touch event and blurring it.
Essentially, I'd like to be able to remove whatever events sencha automatically installs to blur things, and handle it all myself. Sometimes I want to blur, sometimes I don't, depending on what is clicked.
So, what can I do?
You can pass focus to an element in javascript as such:
element.focus()
I'm doing that with a input text box and it works fine. The input box gets focus and the cursor is in it.
We now want to also trigger the soft keyboard on touch devices. By default, putting focus on a field via JS will move the cursor into the field, but won't open the keyboard until the user physically taps on the field.
Is there a way to trigger a touch event (I'm guessing touchstart) akin to this:
element.touchstart()
That doesn't work, but hoping there is some method for this...
BTW, this is primarily for webkit. We're trying to get this working on an iPhone and BB Torch.
The event is ontouchstart instead of touchstart