Closed evanwang0 closed 10 months ago
Worth mentioning that the issue requests RTL on the fly and while not implemented in the PR can be done through replacing this.writingDirection
with a form of document.dir
Worth mentioning that the issue requests RTL on the fly and while not implemented in the PR can be done through replacing
this.writingDirection
with a form ofdocument.dir
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. @asgvard , @predikament : When can we expect this fix to be reviewed/merged and made available?
Thanks @evanwang0 👍 Tried out this fix and it seems to be working as expected. @asgvard , @predikament : When can we expect this fix to be reviewed/merged and made available?
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 dir="rtl"
to the <html>
tag once we inspect the app in the element inspector.
Quick Demo Video :
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.