diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-09-24 00:40:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-24 00:40:10 +0200 |
commit | 5b8d0ad71b137724660455b41f5e19db438aa201 (patch) | |
tree | 8d8828e35d55c120422c6071ae77c5b0d2935c7f /app/javascript/mastodon/components/dropdown_menu.js | |
parent | 233258c61b23785adbd46cba4ed33ee955ecc7a2 (diff) |
Dropdown triangles a bit nicer, smoother scrolling on touch (#5062)
Diffstat (limited to 'app/javascript/mastodon/components/dropdown_menu.js')
-rw-r--r-- | app/javascript/mastodon/components/dropdown_menu.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index 1cfa7b5a2..c0fbcab6d 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -4,6 +4,9 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import IconButton from './icon_button'; import { Overlay } from 'react-overlays'; import { Motion, spring } from 'react-motion'; +import detectPassiveEvents from 'detect-passive-events'; + +const listenerOptions = detectPassiveEvents.hasSupport ? { passive: true } : false; class DropdownMenu extends React.PureComponent { @@ -33,12 +36,12 @@ class DropdownMenu extends React.PureComponent { componentDidMount () { document.addEventListener('click', this.handleDocumentClick, false); - document.addEventListener('touchend', this.handleDocumentClick, false); + document.addEventListener('touchend', this.handleDocumentClick, listenerOptions); } componentWillUnmount () { document.removeEventListener('click', this.handleDocumentClick, false); - document.removeEventListener('touchend', this.handleDocumentClick, false); + document.removeEventListener('touchend', this.handleDocumentClick, listenerOptions); } setRef = c => { |