Skip to content

Commit

Permalink
fix(keyboard): do not set document selection when typing on <input> (
Browse files Browse the repository at this point in the history
…#679)

* Skip setting Selection range for inputs and textareas

* Move type check
  • Loading branch information
sydneyjodon-wk committed May 12, 2021
1 parent 224b207 commit f2fec13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/edit/selectionRange.ts
Expand Up @@ -96,6 +96,11 @@ export function setSelectionRange(
}
}

// Moving the selection inside <input> or <textarea> does not alter the document Selection.
if (isElementType(element, 'input') || isElementType(element, 'textarea')) {
return
}

const range = element.ownerDocument.createRange()
range.selectNodeContents(element)

Expand Down

0 comments on commit f2fec13

Please sign in to comment.