type='number' on masked input - Throws error on focus and text entry
See original GitHub issueπ bug report
Is this a regression?
No, the issue occurs on 11.1.5 and 11.0.0
Description
Using input type='number'
with a mask of mask='0'
throws an error on focus and on text entry.
It appears to work correctly otherwise.
I am using input type to trigger the number keyboard on mobile devices.
π¬ Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-zd58bk?devtoolsheight=33&file=src/app/app.component.html
π₯ Exception or Error
Chrome:
On focus:
ERROR
Error: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('number') does not support selection.
On text entry:
ERROR
Error: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.
Firefox
Same error for focus and text entry:
Error: An attempt was made to use an object that is not, or is no longer, usable
π Your Environment
Angular Version:
Angular CLI: 11.2.5
Node: 14.15.4
OS: darwin x64
Angular: 11.2.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1102.5
@angular-devkit/build-angular 0.1102.5
@angular-devkit/core 11.2.5
@angular-devkit/schematics 11.2.5
@angular/cdk 11.2.5
@angular/cli 11.2.5
@angular/material 11.2.5
@schematics/angular 11.2.5
@schematics/update 0.1102.5
rxjs 6.6.6
typescript 4.1.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Implement an input with a mask - Stack Overflow
I'm using this in a phone number input field in a modal and in some cases the user will already have a phone...
Read more ><input>: The Input (Form Input) element - HTML
A field for editing an email address. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers andΒ ......
Read more >Input Mask Guide | imaskjs
vanilla javascript input mask. ... Getting Started. Install from npm: npm install imask ... If you apply mask to input element you have...
Read more >Masked Field - CMS Design System
Applies date format masking to the input value entered and renders to a text field above the input. Passing true to valueOnly will...
Read more >Input | Quasar Framework
The QInput Vue component is used to capture text input from the user. ... validation status against the 'rules' only after field loses...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I only know of selection functions which is mentioned here for what type of inputs support them: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange
Changing the type to be βtelβ should do what you want to