Use effective direction when attached to mirror slider X#191
Use effective direction when attached to mirror slider X#191
Conversation
| }, | ||
|
|
||
| attached: function() { | ||
| this._isRTL = window.getComputedStyle(this)['direction'] === 'rtl'; |
There was a problem hiding this comment.
The getComputedStyle() in attached is costly, and could degrade performance significantly especially if there are multiple instances of this element. Don't know of any alternatives tho - thoughts @frankiefu?
There was a problem hiding this comment.
Yeah, as @keanulee points out getComputedStyle will force layout and so not really ideal here. There is :dir() CSS pseudo-class which will solve this problem but it's not implemented in Chrome yet. So without :dir or host-context one workaround is to manually check for dir attribute on the parent and the body. @sorvell did a quick prototype on this: https://glitch.com/edit/#!/fern-scarf
There was a problem hiding this comment.
@frankiefu yep, I know about :dir() and how it doesn't work in Chrome yet.
Did you read the bug? #190 it talks about how just checking [dir] is not good enough.
There was a problem hiding this comment.
Unfortunately without better platform support this is the limitation we have to endure without sacrificing performance. It seems to me the biggest issue is currently there is no way to force the direction of the slider to be LTR when the page's has a dir="rtl". I'd suggest we just make it to support if someone wants to override the dir it has to be set on paper-slider <paper-slider dir="ltr">.
|
See #199, which covers some of this functionality |
Fixes #190