PolymerElements/iron-input

[iron-input#2.0-preview] input

Closed this issue · 1 comments

Description

The iron-input element resets the cursor position when typing characters.

Expected outcome

Considering you have an iron-input element which contains the following value: '123456'.
Try to insert the characters 'ab' after the character '3' by first moving the cursor after the character '3' and type consecutively the character 'a', then the character 'b'.
The 'ab' text is inserted.

Actual outcome

Considering you moved the cursor after the character '3', when you type 'a', the cursor is placed at the end of the iron-input value.

Investigation

When you type something, the _onInput function is called. Into this method, a statement (this.bindValue = this._previousValidInput = this.inputElement.value;) triggers the _bindValueChanged method. Into this method, the statement inputElement.value = bindValue; resets the value of the input resulting to change the cursor position to the end of the value.

fixed in f957890