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

Confirmed Issue #10634971 • Assigned to Grisha L.

Details

Created
Jan 24, 2017
Privacy
This issue is public.
Reports
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

Attachments

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”

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

    Sign in