]> cat aescling's git repositories - mastodon.git/commitdiff
fix(columns_area): Manually set tabs style when swiping (#4320)
authorSorin Davidoi <sorin.davidoi@gmail.com>
Wed, 26 Jul 2017 17:03:56 +0000 (19:03 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 26 Jul 2017 17:03:56 +0000 (19:03 +0200)
app/javascript/mastodon/features/ui/components/columns_area.js

index 7de66ce3f9d224065b842f36f276637508ea3bb9..63bd1b0212ac614ecd453a3efde76c950f0b52e4 100644 (file)
@@ -56,6 +56,15 @@ export default class ColumnsArea extends ImmutablePureComponent {
 
   handleSwipe = (index) => {
     this.pendingIndex = index;
+
+    const nextLinkTranslationId = links[index].props['data-preview-title-id'];
+    const currentLinkSelector = '.tabs-bar__link.active';
+    const nextLinkSelector = `.tabs-bar__link[data-preview-title-id="${nextLinkTranslationId}"]`;
+
+    // HACK: Remove the active class from the current link and set it to the next one
+    // React-router does this for us, but too late, feeling laggy.
+    document.querySelector(currentLinkSelector).classList.remove('active');
+    document.querySelector(nextLinkSelector).classList.add('active');
   }
 
   handleAnimationEnd = () => {