Setting selection in onfocus handler of input doesn't place the selection properly

Confirmed Issue #10634971 • Assigned to Grisha L.


Jan 24, 2017
This issue is public.
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

The attached file creates an html page with two input fields, created with javascript.

Input2 has an ‘onfocus’ event which uses selectionEnd to highlight a portion of the text.

When we set the selectionEnd in onfocus handler, Chrome processes the default action of focus event first and then overrides the selection.
Ex: When we set focus on the input element through JS, Chrome’s default action is to place the caret at the end when the value is set through JS. In onfocus handler, when we query this selection on Chrome, the start and end points to the end of the text. If we set the selectionEnd or selectionStart through JS, then it overrides the previous selection with this value.
Edge doesn’t follow this logic


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Grisha L.”

      Changed Steps to Reproduce

      Changed Steps to Reproduce

      Changed Status to “Confirmed”

      Changed Assigned To from “Grisha L.” to “Amit J.”

      Changed Assigned To from “Amit J.” to “Grisha L.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in