From ebf5a060843697d6c51ddfa2f80c1cff1054799e Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Tue, 25 Jul 2017 01:05:51 +0200 Subject: fix(column): Use passive wheel listener (#4348) * chore(yarn): Install detect-passive-events * fix(column): Use passive listener --- app/javascript/mastodon/components/column.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/javascript/mastodon/components/column.js b/app/javascript/mastodon/components/column.js index 3cbb745c5..93f1d6260 100644 --- a/app/javascript/mastodon/components/column.js +++ b/app/javascript/mastodon/components/column.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import detectPassiveEvents from 'detect-passive-events'; import scrollTop from '../scroll'; export default class Column extends React.PureComponent { @@ -30,11 +31,19 @@ export default class Column extends React.PureComponent { this.node = c; } + componentDidMount () { + this.node.addEventListener('wheel', this.handleWheel, detectPassiveEvents ? { passive: true } : false); + } + + componentWillUnmount () { + this.node.removeEventListener('wheel', this.handleWheel); + } + render () { const { children } = this.props; return ( -
+
{children}
); -- cgit