Page MenuHomePhabricator

On Android Chrome, Thai text selections next to a link can collapse unexpectedly
Open, LowPublic


Steps to reproduce:

  1. In VE standalone on Android Chrome, edit an empty document and paste "ภาษาไทย" (two words, with no separating whitespace in accordance with Thai orthography).
  2. Touch and hold on the first half of the text; the selection will become "ภาษา" (i.e. the browser has identified the Thai word boundary lexically).
  3. Press the link icon and create a link on just this text.
  4. Now touch and hold on the second half of the text; the selection will become "ไทย" (and will not include the link cartouche close).
  5. Drag the left pin right then left, to shrink the selection then regrow it to "ไทย" (again, without the link cartouche close).
  6. Release the touch.

Expected behaviour: the selection stays as "ไทย"

Actual behaviour: the selection collapses to the end of the text.

As well as Thai, any other language where word boundaries do not have whitespace will most probably suffer similar issues. The selection collapse does not happen in a plain contenteditable (without javascript) that just contains <a href="x">ภาษา</a>ไทย</p> .

Event Timeline

With input debugging enabled, it's easier to see that if the selection pin lands between the pre-close nail and the post-close nail then the selection collapses. In fact you can see this just editing <h1><a href='x'>foo</a> bar</h1>.

This is probably our selection resizing code triggering a selection collapse when dragging with pins.

dchan moved this task from Up next to Current work on the VisualEditor board.
dchan edited projects, added VisualEditor (Current work); removed VisualEditor.
dchan moved this task from Incoming to In progress on the VisualEditor (Current work) board.

On looking again, it seems enabling input debugging changes the behaviour (at least now it does).

Without input debugging, following the steps above results in the selection collapsing on touchend. With input debugging, the selection either is stable (if when touchend happens it lies entirely inside the text node "ไทย") or collapses immediately (as soon as the selection crosses the post-close nail).

Examining the touchend collapse with ve.Filibuster does not show any Javascript moving the selection, so it may be some obscure piece of code run via setTimeout.

JTannerWMF added a subscriber: JTannerWMF.

@dchan it looks like you've done some initial investigations. What do you think the next steps are?

I am moving this to the freezer after talking more with David, it isn't a high priority.

JTannerWMF lowered the priority of this task from High to Low.Feb 10 2020, 1:51 PM

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See for tips how to best manage your individual work in Phabricator.)