FIX: Don't process infinite scrolling while safari hacks are active

This commit is contained in:
Robin Ward 2016-03-22 16:36:20 -04:00
parent e8e9ce3a0b
commit 86d2773d3a
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import DiscourseURL from 'discourse/lib/url';
import { keyDirty } from 'discourse/widgets/widget';
import MountWidget from 'discourse/components/mount-widget';
import { cloak, uncloak } from 'discourse/widgets/post-stream';
import { isWorkaroundActive } from 'discourse/lib/safari-hacks';
function findTopView($posts, viewportTop, min, max) {
if (max < min) { return min; }
@ -38,6 +39,7 @@ export default MountWidget.extend({
scrolled() {
if (this.isDestroyed || this.isDestroying) { return; }
if (isWorkaroundActive()) { return; }
const $w = $(window);
const windowHeight = window.innerHeight ? window.innerHeight : $w.height();

View File

@ -6,6 +6,11 @@ function applicable() {
!navigator.userAgent.match(/Trident/g);
}
let workaroundActive = false;
export function isWorkaroundActive() {
return workaroundActive;
}
// per http://stackoverflow.com/questions/29001977/safari-in-ios8-is-scrolling-screen-when-fixed-elements-get-focus/29064810
function positioningWorkaround($fixedElement) {
if (!applicable()) {
@ -37,12 +42,12 @@ function positioningWorkaround($fixedElement) {
if (evt) {
evt.target.removeEventListener('blur', blurred);
}
workaroundActive = false;
};
var blurred = _.debounce(blurredNow, 250);
var positioningHack = function(evt){
const self = this;
done = false;
@ -76,6 +81,7 @@ function positioningWorkaround($fixedElement) {
evt.preventDefault();
self.focus();
workaroundActive = true;
};
function attachTouchStart(elem, fn) {