Bug 209736 - textarea selectionDirection returns 'none' for mouse selection
Summary: textarea selectionDirection returns 'none' for mouse selection
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 13
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-30 05:38 PDT by Bing Wang
Modified: 2020-03-30 14:51 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bing Wang 2020-03-30 05:38:53 PDT
Steps to reproduce the problem:
1. Select some text inside a textarea in backward/forward direction
2. get selectionDirection property on that textarea via javascript

What is the expected behavior?
Expected to get value 'backward/forward'

What went wrong?
Always get 'none'

Did this work before? N/A 

Here's jsFiddle that demonstrates the behavior:
http://jsfiddle.net/7Mhqy/1/
Comment 1 Radar WebKit Bug Importer 2020-03-30 13:41:02 PDT
<rdar://problem/61070960>
Comment 2 Alexey Proskuryakov 2020-03-30 13:45:28 PDT
This property only works for keyboard selection (Shift+Right/Left) in WebKit and in Chrome. It does work for mouse selection in Firefox.
Comment 3 Ryosuke Niwa 2020-03-30 14:51:03 PDT
(In reply to Bing Wang from comment #0)
> Steps to reproduce the problem:
> 1. Select some text inside a textarea in backward/forward direction
> 2. get selectionDirection property on that textarea via javascript
> 
> What is the expected behavior?
> Expected to get value 'backward/forward'
> 
> What went wrong?
> Always get 'none'

This is expected. On macOS, mouse selection is directionless. The selection extends backwards or forwards depending on user's input, at which point the direction will be determined.