Created attachment 366466 [details] Testcase Load the attached testcase, click in the input, and type the letter 'a'. Note how the caret stays on the left side. Now type 'b' Note how the letter was input on the right side, which is not where the caret shows.
<rdar://problem/49507145>
Also, if you hit Command-Right arrow to move the caret to the end, and type, the text is inserted on the left side.
This is expected. We show the caret at where the next character whose directionality match that of the block direction.
The behavior doesn't make sense, and doesn't agree with Firefox. If I type a character, I expect it to get inserted where the caret is.
It also doesn't match native text fields in RTL.
(In reply to Simon Fraser (smfr) from comment #5) > It also doesn't match native text fields in RTL. Yeah, indeed. It looks like NSTextView has changed its behavior at some point in the past. Note that Firefox's behavior is irrelevant here because each browser implements its own bidi behavior in this regard, and we really want to match the platform convention.
Oh, I guess the difference is whether I'm actually entering characters in an RTL language. If I type Hebrew, it works as expected. If I type English, it does not.
Typing "1234" and moving the caret around shows that we don't match the OS.
(In reply to Simon Fraser (smfr) from comment #7) > Oh, I guess the difference is whether I'm actually entering characters in an > RTL language. If I type Hebrew, it works as expected. If I type English, it > does not. Yeah, it looks like NSTextView decides the caret location based on the last character being typed. Implementing the new NSTextView behavior is going to be a massive undertaking.
(In reply to Simon Fraser (smfr) from comment #8) > Typing "1234" and moving the caret around shows that we don't match the OS. Numbers are tricky because they're weakly LTR. Try typing numbers after Hebrew / Arabic.
This is reproducible in WebKit ToT (266363@main) and Chrome Canary 117 as well. Only Firefox Nightly 117 show 'caret' properly on the right side while typing.