Use passive listener in privacy_dropdown.js (#5037)
This commit is contained in:
parent
245816ab27
commit
0df6442636
1 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { injectIntl, defineMessages } from 'react-intl';
|
import { injectIntl, defineMessages } from 'react-intl';
|
||||||
import IconButton from '../../../components/icon_button';
|
import IconButton from '../../../components/icon_button';
|
||||||
|
import detectPassiveEvents from 'detect-passive-events';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
|
public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
|
||||||
|
@ -89,12 +90,12 @@ export default class PrivacyDropdown extends React.PureComponent {
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
window.addEventListener('click', this.onGlobalClick);
|
window.addEventListener('click', this.onGlobalClick);
|
||||||
window.addEventListener('touchstart', this.onGlobalClick);
|
window.addEventListener('touchstart', this.onGlobalClick, detectPassiveEvents.hasSupport ? { passive: true } : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
window.removeEventListener('click', this.onGlobalClick);
|
window.removeEventListener('click', this.onGlobalClick);
|
||||||
window.removeEventListener('touchstart', this.onGlobalClick);
|
window.removeEventListener('touchstart', this.onGlobalClick, detectPassiveEvents.hasSupport ? { passive: true } : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
setRef = (c) => {
|
setRef = (c) => {
|
||||||
|
|
Loading…
Reference in a new issue