Skip to content

Automatic RTL detection #167

@Tal500

Description

@Tal500

Following #89, I am wondering why can't the library detect automatically whether it's in RTL or not.
The discussion has started because of the following discussion in the Svelte port of this library.

The idea I said there is to detect automatically the direction by the expression getComputedStyle(container).direction === 'rtl', instead of the manual API property rtl (discussed there in more details).
I am a native Hebrew speaker, so I have an experience with those types of issues.

Sometimes it is even essential to detect this automatically, since the component using this library might be contained in a different component, which allow the end user switch dynamically the text direction (e.g. changing the language from English to Hebrew shall change the text direction from LTR to RTL), and the inner component might not be aware of this change, so it couldn't change the API property rtl.

If for some reason(that makes no sense for me) you'd like to give the user a control to override this automatic RTL detection, I'm suggesting then to convert the type of the API property rtl to boolean | undefined, with a default value of undefined (meaning automatic detection).

I would like to here your opinion 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions