-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add support for RTL #96
Conversation
Worth mentioning that the issue requests RTL on the fly and while not implemented in the PR can be done through replacing |
Hi @evanwang0, Quick question regarding this PR, Once integrated will this allow the app to focus the rightmost element first instead of leftmost element? |
@akash-kush9 That is correct. |
Thanks @evanwang0 👍 Tried out this fix and it seems to be working as expected. |
We've just added this task to our backlog and it will be reviewed ASAP; We'd like to get this functionality included in a good way. |
Tested this PR locally, seems pretty complete and RTL layout quite well integrated. Just as a hint for testing : https://www.aleksandrhovhannisyan.com/blog/changing-locale-in-chrome-with-dev-tools/ or We can add Quick Demo Video : Grabacion.de.pantalla.2023-11-14.a.las.15.22.06.mov |
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 am waiting for the approval, thank you guys. |
This PR adds support for RTL and addresses issue #88. Feel free to request changes, overwrite, or ignore and close this PR. The PR is provided as a courtesy.
Here is a summary of the changes:
rtl
flag toinit
functionWritingDirection
right
&bottom
toFocusableComponentLayout
getChildClosestToOrigin
to support search from the top right corner of the viewport based on writing directionisIncrementalDirection
to support RTLright
/bottom
rtl
in theVisualDebugger
Notes:
no-nested-ternary
eslint rule as it's useful for concisely defining cases.getChildClosestToOrigin
. All of the other changes should preserve logic in either writing direction. The changes to the other functions are primarily to preserve the meaning of the variableisIncrementalDirection
. In other words, the booleansisVertical
andisIncrementalDirection
together map toleft
,up
,right
,down
. However, with RTL support,isVertical
,isIncrementalDirection
, andwritingDirection
is needed to map to the same directions. These functions could be rewritten to use the direction directly so that logic is identical regardless of writing direction.