From a38221f1c90ae7a4bcc916920a4e89aa87ea5d8b Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Mon, 27 Nov 2017 16:42:55 -0700 Subject: [PATCH] Fix RTL switching sides of menus and buttons --- less/mobile.less | 4 ++++ lib/persona.js | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/less/mobile.less b/less/mobile.less index 34e538f..d0abd0f 100644 --- a/less/mobile.less +++ b/less/mobile.less @@ -56,6 +56,10 @@ line-height: 30px; border: none; + html[data-dir="rtl"] button& { + margin-left: 0; + } + .header & .notification-icon { left: auto; right: 7px; diff --git a/lib/persona.js b/lib/persona.js index 3e9dd2c..aa4a5bb 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -118,20 +118,24 @@ $(document).ready(function() { // initialization var guest = !app.user || !parseInt(app.user.uid, 10); - var legacy = !!Storage.getItem('persona:menus:legacy-layout'); + var swapped = !!Storage.getItem('persona:menus:legacy-layout'); var margin = window.innerWidth; - if (legacy) { + if (swapped) { $('#mobile-menu').removeClass('pull-left'); $('#mobile-chats').addClass('pull-left'); } + if (document.documentElement.getAttribute('data-dir') === 'rtl') { + swapped = !swapped; + } + var navSlideout = Pulling.create({ panel: document.getElementById('panel'), menu: document.getElementById('menu'), width: 256, margin: margin, - side: legacy ? 'right' : 'left', + side: swapped ? 'right' : 'left', }); $('#menu').removeClass('hidden'); @@ -142,7 +146,7 @@ $(document).ready(function() { menu: document.getElementById('chats-menu'), width: 256, margin: margin, - side: legacy ? 'left' : 'right', + side: swapped ? 'left' : 'right', }); $('#chats-menu').removeClass('hidden'); }