about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-24 00:40:10 +0200
committerGitHub <noreply@github.com>2017-09-24 00:40:10 +0200
commit5b8d0ad71b137724660455b41f5e19db438aa201 (patch)
tree8d8828e35d55c120422c6071ae77c5b0d2935c7f /app/javascript
parent233258c61b23785adbd46cba4ed33ee955ecc7a2 (diff)
Dropdown triangles a bit nicer, smoother scrolling on touch (#5062)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/components/dropdown_menu.js7
-rw-r--r--app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js11
-rw-r--r--app/javascript/styles/components.scss4
-rw-r--r--app/javascript/styles/emoji_picker.scss2
4 files changed, 15 insertions, 9 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 => {
diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
index 3cac9b7a6..621cc21ce 100644
--- a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
+++ b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
@@ -5,6 +5,7 @@ import { Picker, Emoji } from 'emoji-mart';
 import { Overlay } from 'react-overlays';
 import classNames from 'classnames';
 import ImmutablePropTypes from 'react-immutable-proptypes';
+import detectPassiveEvents from 'detect-passive-events';
 
 const messages = defineMessages({
   emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' },
@@ -24,8 +25,8 @@ const messages = defineMessages({
 });
 
 const assetHost = process.env.CDN_HOST || '';
-
 const backgroundImageFn = () => `${assetHost}/emoji/sheet.png`;
+const listenerOptions = detectPassiveEvents.hasSupport ? { passive: true } : false;
 
 class ModifierPickerMenu extends React.PureComponent {
 
@@ -60,12 +61,12 @@ class ModifierPickerMenu extends React.PureComponent {
 
   attachListeners () {
     document.addEventListener('click', this.handleDocumentClick, false);
-    document.addEventListener('touchend', this.handleDocumentClick, false);
+    document.addEventListener('touchend', this.handleDocumentClick, listenerOptions);
   }
 
   removeListeners () {
     document.removeEventListener('click', this.handleDocumentClick, false);
-    document.removeEventListener('touchend', this.handleDocumentClick, false);
+    document.removeEventListener('touchend', this.handleDocumentClick, listenerOptions);
   }
 
   setRef = c => {
@@ -157,12 +158,12 @@ class EmojiPickerMenu 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 => {
diff --git a/app/javascript/styles/components.scss b/app/javascript/styles/components.scss
index 371c94831..62c9b0066 100644
--- a/app/javascript/styles/components.scss
+++ b/app/javascript/styles/components.scss
@@ -1265,14 +1265,14 @@
   &.top {
     bottom: -5px;
     margin-left: -13px;
-    border-width: 5px 5px 0;
+    border-width: 5px 7px 0;
     border-top-color: $ui-secondary-color;
   }
 
   &.bottom {
     top: -5px;
     margin-left: -13px;
-    border-width: 0 5px 5px;
+    border-width: 0 7px 5px;
     border-bottom-color: $ui-secondary-color;
   }
 
diff --git a/app/javascript/styles/emoji_picker.scss b/app/javascript/styles/emoji_picker.scss
index dbd9dbd97..2b46d30fc 100644
--- a/app/javascript/styles/emoji_picker.scss
+++ b/app/javascript/styles/emoji_picker.scss
@@ -91,8 +91,10 @@
 .emoji-mart-scroll {
   overflow-y: scroll;
   height: 270px;
+  max-height: 35vh;
   padding: 0 6px 6px;
   background: $simple-background-color;
+  will-change: transform;
 }
 
 .emoji-mart-search {