Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi !
This is an attempt to add support for RTL. I have not tested all possibilities but it seems to work well on the few cases I tried. While I ported everything to logical properties, I only tried the RTL (I am not aware of any language reversing the block order).
Here are the main changes that have been done:
I decided to keep "left" and "top" at the final step (what is returned to calculations) because the native scrollIntoView, scrollTo, scrollBy... do not support logical property so it would be confusing for the library consumer.
I am not 100% confident of all the changes, and I have no guarantee that all situations work properly, but this should be a good start to provide RTL feature.
EDIT: for the implementation I decided to rely on "document.dir" instead of having an extra option in the library. I know some librairies explicitly require a direction option, but a lot of thing break in RTL context if the document does not have the
dir="rtl"
attribute set, so I think we should do this to encourage people to add the correct attribute on the document.