Page MenuHomePhabricator

Research faking linear selections on mobile
Open, HighPublic

Description

Fake selections are where there is no native ContentEditable DOM selection, but instead a "selection" is emulated through styling, event listeners etc.

At present, we effectively have three sorts of selection:

  1. Null selection: soft keyboard closed, full screen view for document
  2. Fake selection: soft keyboard closed, full screen view for document
  3. Real selection: soft keyboard open, reduced viewport for document

We already fake table selections, and linear selections if the range is a focusable node. This task is to explore whether fake selections could take the place of real ones in more cases.

Reasons this would be useful

  • Could fix a whole load of fiddly edge cases that arise because of the interaction between native selections, selection pins, the soft keyboard, and native selection context menus: see T209505. Significant examples include T204387 and T202723 (for iOS).
  • Would be nice to get the full screen when doing edits that don't involve text input.

Reasons this is a dubious idea

  • Native selections have a lot of functionality: grapheme clusters, pins, native context actions, etc. It would be infeasible to reimplement all these.
  • Hard to get wrapping and bidi correct
  • Native functionality is constantly improving: we would have a hard time keeping abreast
  • Still need to interact with the soft keyboard sometimes

A less radical alternative would be to null the selection more aggressively, e.g. when a non-expanded cursor is scrolled away so it no longer appears in the viewport.

Event Timeline

Native selections have a lot of functionality: grapheme clusters, pins, native context actions, etc. It would be infeasible to reimplement all these.

Note also on iOS there's the magnifying glass for cursor placement when you move it:
https://images.techhive.com/images/article/2016/10/6-things-ios-to-android-switchers-will-miss-5-things-ios-to-android-switchers-will-miss-magnifying-glass-for-cursor_4-100688054-orig.jpg

Still thinking about programmatic (a.k.a. "fake") selections, but stepping back from the idea that they should be as similar as possible to real ones, some sort of mechanism to select large amounts of content would be useful for large copy/paste tasks (see https://www.mediawiki.org/wiki/Topic:Ul1orwmwk2q32l1v for one such request)

Removing task assignee due to inactivity, as this open task has been assigned for more than two years (see emails sent to assignee on May26 and Jun17, and T270544). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be very welcome!

(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)