W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2011

[whatwg] Control over selection direction

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Fri, 6 May 2011 14:28:18 -0700
Message-ID: <BANLkTimF=SwBEFxSGSvzUXNKhBcuhbyKUw@mail.gmail.com>
On Tue, May 3, 2011 at 4:49 PM, Ian Hickson <ian at hixie.ch> wrote:
>
> I've added selectionDirection = 'forward'/'backward'/'none'. ('none' is
> the default selection direction on Mac OS.)


Thank you for the update!  One thing to point out is that setSelectionRange
in WebKit currently sets "forward" direction when the argument is omitted so
the following lines in the spec 4.10.20 should be revised

The direction of the selection must be set to *backward* if direction is a
case-sensitive<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#case-sensitive>
match
for the string "backward", *forward* if direction is a
case-sensitive<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#case-sensitive>
match
for the string "forward" or if the platform does not support selections with
the direction *none*, and *none* otherwise (including if the argument is
omitted)

to

The direction of the selection must be set to *backward* if direction is a
case-sensitive<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#case-sensitive>
match
for the string "backward", *forward* if direction is a
case-sensitive<http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#case-sensitive>
match
for the string "forward" or if the argument is omitted or the platform does
not support selections with the direction *none*, and *none* otherwise.

On Fri, May 6, 2011 at 2:00 PM, Aryeh Gregor <Simetrical+w3c at gmail.com>wrote:
>
> What does "none" mean?


Means that there's selection doesn't have directionality and the behavior is
platform-dependent.


> If the user hits the right arrow key, does the cursor move to the right of
> the last character of the selection or the first?


On WebKit on Mac, selection is extended forward (right in LTR / left in RTL)
when you press the right arrow key. Selection is extended backward (left in
LTR / right in RTL) when you press the left arrow key.  But that's just one
platform-dependent behavior and shouldn't be considered normative.

What should UAs do on platforms that don't support the concept of a "none"
> direction (assuming there are such)?
>

It should default to forward.

This is also inconsistent with Selection, which has only two directions.


It is consistent since WebKit on Mac supports non-directional DOM Selection.

- Ryosuke
Received on Friday, 6 May 2011 14:28:18 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:05 UTC