Open Bug 1788929 Opened 2 years ago Updated 2 years ago

Reversed text selection in RTL languages

Categories

(Core :: DOM: Selection, defect)

Firefox 102
defect

Tracking

()

People

(Reporter: avidseeker7, Unassigned)

Details

Expected results:

Video: https://i.imgur.com/JE70qld.mp4
You can test it here: https://ar.wikipedia.org/w/index.php?title=%D9%84%D9%8A%D9%86%D9%83%D8%B3&action=edit

Try navigating using 1) RArrow, LArrow, then 2) Ctrl+RArrow, Ctrl+LArrow, then 3) Ctrl+Shift+RArrow, Ctrl+Shift+LArrow.

You'll see that 1), and 2) are working as expected but not 3).

Notice that Ctrl+Shift+Rarrow moves selection to the left, when it should have moved it to the right.

Tested to work on Google Chrome, Kate, gedit, on multiple linux distros. This bug might not apply to Windows.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Selection' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Selection
Product: Firefox → Core

The logic here is:

Firefox, Chrome, gedit: movement without selection is visual (right arrow moves the i-beam right regardless of text direction)

Firefox selection: selection is logical: right arrow selects forward in text direction
Chrome: selection progresses logically but arrows are bound visually based on what directionality the selection starts in. If selection starts in LTR text, right arrow selects forward. If selection starts in RTL text, right arrow selects backward.
gedit: selection progresses logically but arrows are bound visually based on the directionality of the paragraph that the selection starts in. If selection starts in LTR paragraph, right arrow selects forward. If selection starts in RTL paragraph, right arrow selects backward.

Overall, it seems it would increase cross-app consistency to bind the arrows visually depending on where the selection starts. It's probably the safest to go with the Chrome approach instead of the gedit approach.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true

Here is an illustration differentiating "Logical Navigation" and "Visual Navigation": https://imgur.com/a/lfQV88E
I added this to the ArchWiki: https://wiki.archlinux.org/title/Bidirectional_text#Concepts

  • Logical navigation: words are traversed as they are read.
  • Visual navigation: words are traversed as they are displayed.

I hope this clarifies the bug with Firefox more.

Yes, there's a difference depending on the environment direction (RTL or LTR). In the case of both Firefox and Chrome, text is taken from Arabic Wikipedia which is set Right-to-left. But Chrome works correctly and Firefox isn't.

You need to log in before you can comment on or make changes to this bug.