I'm trying to detect if on ios (or any other mobile device for that matter) goes into background mode.
onblur doesn't seem to fire.
I was just wondering if there was another method I could use.
Cheers
Related
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.
A simple question that I just can't find an answer for. I want to stop a periodic AJAX call when the user has wandered away and locked their PC. I don't need it to be every OS compatible or every browser (Chrome and IE would be good).
setInterval just doesn't seem to stop when locked and AJAX is also not prevented. The visibilitychange event seems to think that the tab is visible unless you switch to another tab.
I have stated javascript, but I only care that it can be done within the browser without asking the user.
Edge does seem to indicate it is hidden when locked, so I'm ok with that browser.
Thanks
You can use the Idle.js library to detect if the user is looking away from the browser window or is inactive (his input devices are inactive).
Whatever the case, there's not a reliable way to get the OS or the screen saver state from the browser
In your javascript it is not possible to detect if the OS UI has locked. The browser sand box prevents this kind of access to OS resources for security reasons. You would need to write a browser plugin to do this.
*I have searched online and on SO
I have a mobile site made in jQuery Mobile. If the user has navigated away from the mobile browser on their phone, (to another app), which would hide the mobile browser (but the mobile browser would still be running on their phone), I need a way in Javascript or jQuery to know when the user opens their mobile browser again.
I have packaged the mobile site as an app using PhoneGap and I currently achieve this by using the onResume() function.
You can detect when the tab or window is closed via the onunload and onbeforeunload events. These will trigger if the tab is closed, the back button is hit or an exit link is clicked.
There's a proposal to allow webapps to detect if they're in the foreground or not, the visibilitychange event, http://www.w3.org/TR/2013/REC-page-visibility-20131029/#sec-visibilitychange-event
It's partially supported, mainly by newer browsers, so depending on your needs it may work for you. http://caniuse.com/#feat=pagevisibility
In Safari Mobile on iOS <8, all Javascript was paused while the user was scrolling. Since the release of iOS 8, this is no longer the case, as you can read here:
http://developer.telerik.com/featured/scroll-event-change-ios-8-big-deal/
This is great news. Executing Javascript while scrolling (if done right), opens the possibility for many usability enhancements (like sticky menus) and effects (like parallax).
Is there a way to get the same thing in Chrome Mobile on iOS?
The same website states that the first mobile browser that supported live scroll events was Chrome on Android 4.0. If that's the case, why is it still disabled in the newest Chrome on iOS?
This might be the answer:
https://code.google.com/p/chromium/issues/detail?id=423444
If the new Javascript handling is tied to the new Nitro Javascript Engine used in Safari Mobile (and in WKWebView), then we will have continuous scroll events in Chrome Mobile as soon as they switch to use WKWebView instead of UIWebView.
EDIT: As of version 48.0.2564.87, Chrome uses WKWebView on iOS, and continuous scroll events are working!
I am writing a webpage that is intended to be viewed on Android phones and hopefully other mobile devices. I am going with a webpage as opposed to an App because it is more platform independent.
I would like to perform an operation continuously while the uses is clicking and holding a button on the webpage. On mobile device the operation would run continuously when they hold their finger on the button on the webpage.
I have tried using the javascript function setInterval() on the onmousedown event of my input button and clearInterval() on the onmouseup event. This works perfectly when accessing the device from any browser on a PC. Unfortunately, it doesn't work on my Android phone. The button appearance does seem to change to the held state when pressed and held but the onmousedown event doesn't get called.
Has anyone found a good way to do press-and-hold button actions that is compatible with Android devices?
Check here:
What DOM events are available to WebKit on Android?
and here:
Quirksmode.org/mobile
Seems that you need to use some of the DOM or touch handlers (last one may have problems when using trackbal)