splitpanes icon indicating copy to clipboard operation
splitpanes copied to clipboard

Automatic RTL detection

Open Tal500 opened this issue 2 years ago • 0 comments

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 🙂

Tal500 avatar May 29 '22 17:05 Tal500