-
Notifications
You must be signed in to change notification settings - Fork 404
fix(clerk-js): Ensure RTL is supported within Drawer component #5906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 9f859df The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
aeliox
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if (dir === 'rtl') { | ||
| return 'rtl'; | ||
| } | ||
|
|
||
| if (dir === 'ltr') { | ||
| return 'ltr'; | ||
| } | ||
|
|
||
| if (dir === 'auto' || !dir) { | ||
| const computedDirection = window.getComputedStyle(element).direction; | ||
| if (computedDirection === 'rtl') { | ||
| return 'rtl'; | ||
| } | ||
| } | ||
|
|
||
| return 'ltr'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it be simplified to this ?
| if (dir === 'rtl') { | |
| return 'rtl'; | |
| } | |
| if (dir === 'ltr') { | |
| return 'ltr'; | |
| } | |
| if (dir === 'auto' || !dir) { | |
| const computedDirection = window.getComputedStyle(element).direction; | |
| if (computedDirection === 'rtl') { | |
| return 'rtl'; | |
| } | |
| } | |
| return 'ltr'; | |
| const default = 'ltr' | |
| if (dir === 'auto' || !dir) { | |
| const computedDirection = window.getComputedStyle(element).direction; | |
| return computedDirection || default; | |
| } | |
| return dir || default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test case why I went with the current approach. I think more explicit/defensive approach is right here, someone could hypothetically apply an invalid dir value as it's just an html attribute.
| if (element) { | ||
| return getDirectionFromElement(element); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we always using documen.documentElement inside drawer ?
Description
Ensure drawer animation respects RTL usage.
Screen.Recording.2025-05-12.at.10.58.44.AM.mov
To test in the sanbox, add
dir="rtl"to the html element within thetemplate.htmlfile.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change