From cea5685aadead7b16c072b9f820ca97e377361ed Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:09:59 -0800 Subject: [PATCH] Fix NavSidebar resize for RTL languages Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> --- ts/components/NavSidebar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ts/components/NavSidebar.tsx b/ts/components/NavSidebar.tsx index dafff7d3de..8f69609da6 100644 --- a/ts/components/NavSidebar.tsx +++ b/ts/components/NavSidebar.tsx @@ -79,6 +79,7 @@ export function NavSidebar({ title, otherTabsUnreadStats, }: NavSidebarProps): JSX.Element { + const isRTL = i18n.getLocaleDirection() === 'rtl'; const [dragState, setDragState] = useState(DragState.INITIAL); const [preferredWidth, setPreferredWidth] = useState(() => { @@ -102,7 +103,8 @@ export function NavSidebar({ setDragState(DragState.DRAGEND); }, onMove(event) { - const { deltaX, shiftKey, pointerType } = event; + const { shiftKey, pointerType } = event; + const deltaX = isRTL ? -event.deltaX : event.deltaX; const isKeyboard = pointerType === 'keyboard'; const increment = isKeyboard && shiftKey ? 10 : 1; setPreferredWidth(prevWidth => {