about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorNolan Lawson <nolan@nolanlawson.com>2017-06-03 05:43:10 -0700
committerEugen Rochko <eugen@zeonfederated.com>2017-06-03 14:43:10 +0200
commit3363f2f4d6f9bc5ea6fb06f8fcbb6f1093d4abd4 (patch)
tree65642371ec4c606034383117e5a6445986c7387b /app/javascript
parentc7f2d6af55ec397f409939f1e8b4145b435d18da (diff)
Fix isIntersecting in Chrome (#3525)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/status.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index 2abe50f0b..effff569a 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -88,9 +88,11 @@ class Status extends ImmutablePureComponent {
   }
 
   handleIntersection = (entry) => {
-    // Edge 15 doesn't support isIntersecting, but we can infer it from intersectionRatio
+    // Edge 15 doesn't support isIntersecting, but we can infer it
     // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12156111/
-    const isIntersecting = entry.intersectionRatio > 0;
+    // https://github.com/WICG/IntersectionObserver/issues/211
+    const isIntersecting = (typeof entry.isIntersecting === 'boolean') ?
+      entry.isIntersecting : entry.intersectionRect.height > 0;
     this.setState((prevState) => {
       if (prevState.isIntersecting && !isIntersecting) {
         scheduleIdleTask(this.hideIfNotIntersecting);