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 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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue