Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectionStart incompatible on latest Chrome #19

Open
tommeier opened this issue Jan 23, 2014 · 13 comments
Open

selectionStart incompatible on latest Chrome #19

tommeier opened this issue Jan 23, 2014 · 13 comments

Comments

@tommeier
Copy link

Hi,

Chrome version: Version 33.0.1750.29 beta (and dev)

We're noticing errors when attaching to number fields:

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

Have you noticed this? Any known workaround?

@KevinSheedy
Copy link
Owner

Hi Tom
I haven't seen this issue before. Any chance of a code example or a jsfiddle?
Thanks
Kevin

@plasticine
Copy link

Yep, I’m seeing this as well — will prepare a fiddle and try and replicate it for you.

@plasticine
Copy link

Hey, managed to knock up a fiddle that replicates the issue exactly for me in at least the following chrome versions;

  • Version 33.0.1750.46 beta
  • Version 34.0.1809.0 dev
  • Version 34.0.1811.0 canary

http://jsfiddle.net/plasticine/3XBwc/4/

screen shot 2014-01-30 at 10 49 32 am

@KevinSheedy
Copy link
Owner

Thanks guys. As this is only happening in beta versions of Chrome, for now I'm going to assume this is actually a chrome bug. If you see it happening in any full release version of Chrome, please let me know and I'll definitely take another look.
It's working fine in Chrome Version 32.0.1700.107 m

@plasticine
Copy link

FWIW, I’ve had reports of this error from end-users who are also seeing this error on Chrome stable on mobile devices.

@KevinSheedy
Copy link
Owner

Looks like Chrome has disabled the select api for inputs of type number and email. Apparently this is in line with the current whatwg html spec. This has affected several libraries as well as jquery.alphanum.

I've sent the following email to the whatwg mailing list to try get clarification and to request that the select api be re-instated for input types email and password in the official html spec.

Hi

The Chrome browser recently disabled the select api for inputs of type number and email:
https://codereview.chromium.org/100433008/#ps60001

The select api is a collection of attributes and functions that allow us to get and set which portion of text a user has highlighted in an <input>

The attributes and functions in question are:
select()
selectionStart
selectionEnd
selectionDirection
setRangeText()
setSelectionRange()

This change caused bugs in several libraries:

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

https://github.com/KevinSheedy/jquery.alphanum/issues/19

The spec says that these properties should be available for inputs of types text, search, url, telephone and password but not for inputs of type number or email.

I'd like to request that this collection also be made available to inputs of type number and email.

Does anyone have any insight as to why these types were excluded?

Many Thanks,
Kevin

@plasticine
Copy link

Awesome—thanks!

@tarragon
Copy link

FYI: Chrome stable on desktop is now exhibiting this behaviour.

@KevinSheedy
Copy link
Owner

There's an active discussion currently happening on www.w3.org about possibly re-instating the selection API into the spec. This would fix the problem.

It would be great if you could logon and add your support.

@KevinSheedy
Copy link
Owner

I've also logged it as a bug in chromium so it would be great if you could also add your support there.

@plasticine
Copy link

Awesome — will do. Thanks.

On 6 Mar 2014, at 2:25 am, KevinSheedy notifications@github.com wrote:

I've also logged it as a bug in chromium so it would be great if you could also add your support there.


Reply to this email directly or view it on GitHub.

sandeepcisin241 pushed a commit to sandeepcisin241/jquery.alphanum that referenced this issue Mar 12, 2014
@plasticine
Copy link

This issue seems to have also started occurring in the newly released Firefox 29. :(

@rjso
Copy link

rjso commented Oct 30, 2014

A little update on this issue. This also happens with type email. if you take @plasticine example and replace it with email. It will display the exact same error. Funny enough the input type tel works fine with the .numeric on top of it.

Could anyone be kind enough to share a workaround for this error?

gabegorelick added a commit to gabegorelick/jquery.alphanum that referenced this issue Mar 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants