Nir, thank you for responding!

The behavior you describe (“logical” navigation) is what can be seen in many, 
but not all applications, and that is what puzzles me.  What’s more 
interesting, the applications that use a “visual” kind of navigation, that is 
the RIGHT ARROW key always moving the cursor right regardless of the text, is 
used by javafx8 (it’s totally broken in jfx17, but it looks from the code that 
it is supposed to be the same as in javafx8), java swing, MS Word 2007 on 
Windows 10, macOS Notes app, macOS TextEdit, and Mozilla Thunderbird.  Also, 
this is the kind of navigation that some users prefer (based on a very, very 
limited sample I was able to contact).

What puzzles me is that there is no apparent standard even among the modern 
applications (bundled macOS apps), although the transition from visual to 
logical navigation in MS Word might indicate that the logical navigation is 
winning.

The appearance of caret is another aspect that seem to have no standard.  In 
many apps the caret does not change at all, very rarely we see a flag 
indicating direction (java swing), and only javafx8 and some obsolete mac 
Carbon reference doc shows a split caret.

More questions for you:

  1.  it looks like you are on Windows, and are you using (or have you seen) a 
fully localized version of Windows with all the UI set to RTL mode?
  2.  Have you seen any native applications that use the visual navigation 
model?

Getting back to the problem at hand: if we were to retain the backward 
compatibility in FX, we would need to fix the “visual” navigation.  FX uses the 
split caret which some users find confusing but we probably are stuck with it.  
If we were to assume that the “logical” navigation is a standard everyone is 
slowly converging to, then my fix for 
https://bugs.openjdk.org/browse/JDK-8296266 is the right one and we should 
declare a change in behavior.

What do you think?

P.S. I wonder if the logical navigation was chosen because of ease of 
implementation, or is there a deeper reason?




From: Nir Lisker <nlis...@gmail.com>
Date: Monday, October 16, 2023 at 04:52
To: Andy Goryachev <andy.goryac...@oracle.com>
Cc: openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
Subject: [External] : Re: Question: bidi navigation
This is a tricky one. All applications I have seen, and I think that's what 
people expect, is that the cursor changes direction during traversal.

A key point is where the paragraph is aligned to (in Windows adjusted with left 
CTRL+SHIFT and right CTRL+SHIFT). This sets the forward and backward direction: 
if the paragraph is left-aligned, pressing the right arrow moves the cursor 
forward, and for a right aligned, the right arrow moves the cursor backward. 
Then the actual movement of the cursor is relative to the paragraph alignment: 
in RTL alignment, traversing RTL text moves the cursor forward, while 
traversing LTR moves the cursor backward.

Examples
In a left-aligned paragraph, pressing the right arrow will move the cursor (|) 
like this:
|ab אבג cd
a|b אבג cd
ab| אבג cd
ab |אבג cd      OR     ab אבג| cd    (there is ambiguity because the space 
character can be both RTL or LTR)
ab א|בג cd
ab אב|ג cd
ab אבג| cd      OR     ab |אבג cd
ab אבג |cd
ab אבג c|d
ab אבג cd|

To help with navigation, the cursor has a line attached to its top showing 
which direction it's facing.

Hope this helps.

On Thu, Oct 12, 2023 at 3:42 AM Andy Goryachev 
<andy.goryac...@oracle.com<mailto:andy.goryac...@oracle.com>> wrote:
Hi.

I have a question for people who routinely use right-to-left RTL languages 
(Arabic, Hebrew, etc.):

What is your expectation for navigating text using left/right arrow keys when 
the text contains a mixture of RTL and LTR?

It looks like there is no standard when it comes to modern applications – see a 
small sample:
https://gist.github.com/andy-goryachev-oracle/4802f9380fb03ec2be7ac36bd98a2059<https://urldefense.com/v3/__https:/gist.github.com/andy-goryachev-oracle/4802f9380fb03ec2be7ac36bd98a2059__;!!ACWV5N9M2RV99hQ!P_TgGd02CrA1gNF2bW5yHBRJHFkdDqluPJmHDwIcAQ-DR_NWNd-JMkTn0x9d1m5azgCucompGMSgi7PqR7TS$>

In javafx, the navigation of bidirectional (bidi) text might have been broken 
sometime after jfx8, and even jfx8 might have issues, see
https://bugs.openjdk.org/browse/JDK-8296266

It looks like the most modern applications use logical navigation and logical 
selection (that is, when navigating using left/right arrow keys, the cursor 
position reflects previous/next insertion indexes in the text, rather than 
visual position).  This causes the cursor to change the direction of movement 
when it crosses the bidi boundary.  Would you say this is the expected behavior?

Thank you
-andy

Reply via email to