React: setSelectionRange is not a function

Created on 3 May 2017  路  1Comment  路  Source: facebook/react

Do you want to request a feature or report a bug?
Report a bug. 馃悰

What is the current behavior?
Trying to move the cursor in a contenteditable div, calling setSelectionRange on that div throws a TypeError:

element.setSelectionRange is not a function

Example code
https://jsfiddle.net/9xjma402/

What is the expected behavior?
Caret is moved, setSelectionRange is a function

Environments tested on
React 15.5.4
Chrome 57, Safari 10
macOS Sierra

Most helpful comment

Welp, setSelectionRange is of HTMLInputElements and doesn't extend to contenteditable things. My bad, closing. Sorry!

>All comments

Welp, setSelectionRange is of HTMLInputElements and doesn't extend to contenteditable things. My bad, closing. Sorry!

Was this page helpful?
0 / 5 - 0 ratings