Problem with Drawer animations in RTL #9120
Dependencies check up
What version of @mantine/* packages do you have in package.json?9.5.1 What package has an issue?@mantine/core What framework do you use?Next.js In which browsers you can reproduce the issue?Not applicable – issue is not related to the browser Describe the bugthe Drawer componant in a rtl website, If possible, include a link to a codesandbox with a minimal reproductionNo response Possible fixNo response Self-service
|
Replies: 2 comments 3 replies
|
Drawer component works correctly on mantine.dev website. To setup rtl in your application, follow the rtl guide – https://mantine.dev/styles/rtl/ |
|
That exact animation (drawer starts mid-screen and slides to the left edge) is what you get with
Wrap the app in // app/layout.tsx
import { DirectionProvider, MantineProvider } from '@mantine/core'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="ar" dir="rtl">
<body>
<DirectionProvider initialDirection="rtl">
<MantineProvider>{children}</MantineProvider>
</DirectionProvider>
</body>
</html>
)
}Then pick the side. In RTL, Mantine mirrors <Drawer position="right" /> // RTL: left edge, slides in from off-screen left (mirror of LTR)
<Drawer position="left" /> // RTL: right edge, slides in from off-screen rightIf you want the drawer on the physical right in RTL, use Checked on @mantine/core 9.5.1 in Chromium, 1200px wide, tracking the drawer's left and right edges each frame while it opens:
|
That exact animation (drawer starts mid-screen and slides to the left edge) is what you get with
dir="rtl"on<html>but noDirectionProvider. The two halves of the Drawer read direction from different places:position="right"setsjustify-content: flex-end, and in an RTL document flex-end is the left edge.useDirection(). WithoutDirectionProviderthat returnsltr, so it usesslide-left(enter from the right) on a drawer that is sitting on the left.Wrap the app in
DirectionProvider(Next.js App Router):