This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13909 - Selections have three possible directions, not two
Summary: Selections have three possible directions, not two
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Selection API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ryosuke Niwa
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-26 00:05 UTC by Ian 'Hixie' Hickson
Modified: 2014-04-22 07:13 UTC (History)
5 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2011-08-26 00:05:10 UTC
On Mac, a newly created selection is by default neither forward nor backward. See the equivalent text in the HTML spec for input elements.
Comment 1 Aryeh Gregor 2011-08-28 15:39:36 UTC
I don't have a Mac handy for testing, so I don't know how browsers behave on Mac.  If anyone wants to tell me how the spec should change to match browsers, please do.  Adding an explicit settable selection direction property on the Selection interface would also be useful, of course . . .
Comment 2 Aryeh Gregor 2011-09-22 19:31:19 UTC
Moving Selection-related bugs to editing: see bug 14248, bug 14252.
Comment 3 Ryosuke Niwa 2011-10-15 20:28:39 UTC
Selection on Mac is directionless at the beginning. Selection gets a direction when setBaseAndExtent is called on getSelection() or base, extent, focus, or anchor of getSelection() is modified, or selection is extended via arrow keys.

See http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#dom-textarea/input-selectiondirection
Comment 4 Ben Peters 2014-04-21 21:09:19 UTC
Moving to Selection API component.
Comment 5 Ryosuke Niwa 2014-04-22 07:13:39 UTC
I've fixed this when I ported the specification: http://rniwa.github.io/selection-api.html#dfn-direction

"Each selection has a direction, forwards, backwards, or directionless. If the user creates a selection by indicating first one boundary point of the range and then the other (such as by clicking on one point and dragging to another), and the first indicated boundary point is after ([DOM4]) the second, then the corresponding selection must initially be backwards. If the first indicated boundary point is before ([DOM4]) the second, then the corresponding selection must initially be forwards. Otherwise, it must be directionless."