FIX: Don't process infinite scrolling while safari hacks are active
This commit is contained in:
parent
e8e9ce3a0b
commit
86d2773d3a
|
@ -2,6 +2,7 @@ import DiscourseURL from 'discourse/lib/url';
|
||||||
import { keyDirty } from 'discourse/widgets/widget';
|
import { keyDirty } from 'discourse/widgets/widget';
|
||||||
import MountWidget from 'discourse/components/mount-widget';
|
import MountWidget from 'discourse/components/mount-widget';
|
||||||
import { cloak, uncloak } from 'discourse/widgets/post-stream';
|
import { cloak, uncloak } from 'discourse/widgets/post-stream';
|
||||||
|
import { isWorkaroundActive } from 'discourse/lib/safari-hacks';
|
||||||
|
|
||||||
function findTopView($posts, viewportTop, min, max) {
|
function findTopView($posts, viewportTop, min, max) {
|
||||||
if (max < min) { return min; }
|
if (max < min) { return min; }
|
||||||
|
@ -38,6 +39,7 @@ export default MountWidget.extend({
|
||||||
|
|
||||||
scrolled() {
|
scrolled() {
|
||||||
if (this.isDestroyed || this.isDestroying) { return; }
|
if (this.isDestroyed || this.isDestroying) { return; }
|
||||||
|
if (isWorkaroundActive()) { return; }
|
||||||
|
|
||||||
const $w = $(window);
|
const $w = $(window);
|
||||||
const windowHeight = window.innerHeight ? window.innerHeight : $w.height();
|
const windowHeight = window.innerHeight ? window.innerHeight : $w.height();
|
||||||
|
|
|
@ -6,6 +6,11 @@ function applicable() {
|
||||||
!navigator.userAgent.match(/Trident/g);
|
!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
|
// per http://stackoverflow.com/questions/29001977/safari-in-ios8-is-scrolling-screen-when-fixed-elements-get-focus/29064810
|
||||||
function positioningWorkaround($fixedElement) {
|
function positioningWorkaround($fixedElement) {
|
||||||
if (!applicable()) {
|
if (!applicable()) {
|
||||||
|
@ -37,12 +42,12 @@ function positioningWorkaround($fixedElement) {
|
||||||
if (evt) {
|
if (evt) {
|
||||||
evt.target.removeEventListener('blur', blurred);
|
evt.target.removeEventListener('blur', blurred);
|
||||||
}
|
}
|
||||||
|
workaroundActive = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var blurred = _.debounce(blurredNow, 250);
|
var blurred = _.debounce(blurredNow, 250);
|
||||||
|
|
||||||
var positioningHack = function(evt){
|
var positioningHack = function(evt){
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
done = false;
|
done = false;
|
||||||
|
|
||||||
|
@ -76,6 +81,7 @@ function positioningWorkaround($fixedElement) {
|
||||||
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
self.focus();
|
self.focus();
|
||||||
|
workaroundActive = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function attachTouchStart(elem, fn) {
|
function attachTouchStart(elem, fn) {
|
||||||
|
|
Loading…
Reference in New Issue