bidi-js
bidi-js copied to clipboard
getReorderedString of mixed RTL, LTR and Emoji text sometimes differs from browser bidi behavior
When passing a mixed RTL, LTR and Emoji string to getReorderedString
, if the sentence is processed as rtl
, and the emoji is right after an LTR block it seems like it will be considered as a part of the LTR block, while the browser seems to considers it as a new RTL block (I'm not sure I'm 100% familiar with the implementation to use the right terms here):
if the original string is
RRR LLL N
(where N is the Emoji)
The browser will Render it (in a "direction: rtl"
block) as
N LLL RRR
but bidi.js will return
LLL N RRR
if the original string is
RRR LLL R N
both the browser and bidi.js will render it as
N R LLL RRR
a codepen demo: https://codepen.io/tombigel/pen/gOJYQom
Is it expected?