cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

iScroll doesn't work in iPhone when Voiceover is ON #1136

Open yugandhar-pathi opened 7 years ago

yugandhar-pathi commented 7 years ago

I was using iScroll in my Cordova application. It was all good till I enabled voiceover. When I enable voiceover and apply "three finger swipe down" gesture on the page it doesn't work !! Voice read is page 1 of 1 !! Can you please help how to get rid of this?

iamcbh commented 7 years ago

I also meet this issue. When I turn on voiceover, I cannot scroll the page with three fingers, this issue can be reproduce in this demo:http://lab.cubiq.org/iscroll5/demos/infinite/

yugandhar-pathi commented 7 years ago

I found that iScroll is using transform CSS property for scrolling. I was able to resolve this issue. May be you can also try the same.

  1. Add below style to your parent div -webkit-overflow-scrolling : touch

2.There is a phone gap plugin to listen for VoiceOver on/off https://github.com/phonegap/phonegap-mobile-accessibility

// Define a persistent callback method to handle the event
function onScreenReaderStatusChanged(info) {
    if (info && typeof info.isScreenReaderRunning !== "undefined") {
        if (info.isScreenReaderRunning) {
            console.log("Screen reader: ON");
            // Do something to improve the behavior of the application while a screen reader is active.
        } else {
            console.log("Screen reader: OFF");
        }
    }
}

// Register the callback method to handle the event
window.addEventListener(MobileAccessibilityNotifications.SCREEN_READER_STATUS_CHANGED, onScreenReaderStatusChanged, false);

On voiceover on event you can destroy iScroll(or make useTransform property to false). On voiceover off you can re-initiate the iScroll.

Let me know if it works.

iamcbh commented 7 years ago

Thanks your solution, but in my case situation, I need to pull up to load more /pull down to refresh. If I destroy iScroll when voiceover is on, I cannot load more/refresh. What's more, I also need to use iScroll in Android, iScroll works fine in Android.