jquery-simulate-ext icon indicating copy to clipboard operation
jquery-simulate-ext copied to clipboard

Key-sequence throws error with <input type="email"> on Chrome

Open omahlama opened this issue 11 years ago • 2 comments

Test case (forked from demo):

http://jsfiddle.net/omahlama/5xLe3svo/1/

This throws an exception on chrome, the error is:

Failed to read the 'selectionStart' property from 'HTMLInputElement': 
The input element's type ('email') does not support selection.

Related stackoverflow question with the problem explained:

http://stackoverflow.com/questions/21177489/selectionstart-selectionend-on-input-type-number-no-longer-allowed-in-chrome

omahlama avatar Mar 19 '15 09:03 omahlama

Hm... I guess the only way to solve this issue is to either fix it in bililiteRange or replace bililiteRange.

Replacing bililiteRange gets more and more attractive. Rangy seems to be good candidate.

No! I was wrong! I could of course check the type of the element in in the key-sequence plugin and then prevent the creation of the range object. But then the question is: how should the simulation of the special sequences (like {leftarrow}, {backspace}, {selectall}, etc.) behave if we don't know where the cursor is? Should they just be ignored (i.e. no-ops)?

j-ulrich avatar Mar 27 '15 19:03 j-ulrich

I would guess that no-ops with browser detection would be the best option - it would be completely backwards compatible, as no-one was able to do those things with email inputs on chrome anyway.

omahlama avatar Apr 02 '15 08:04 omahlama