igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

igxMask directive doesn't work with input[type="number"].

Open tkiryu opened this issue 8 years ago • 5 comments

Description

igxMask directive doesn't work with input[type="number"].

Steps to reproduce

  1. Go to https://stackblitz.com/edit/igx-editors-issue
  2. Open console panel.
  3. Focus a number input.
  4. Type any characters in it

Result

  1. promptChar doesn't work.

  2. Errors occur.

ERROR Error: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection. Error: Converting circular structure to JSON

Expected result

igxMask directive should work with input[type="number"].

tkiryu avatar Apr 23 '18 05:04 tkiryu

The problem is that setSelectionRange method i no longer allowed on input of type number, as described in this post. I can provide a fix for this problem, but I would recommend not using igxMask on input of type number, use text or tel if possible.. Please let me know if this is critical for your scenario.

SAndreeva avatar Apr 23 '18 15:04 SAndreeva

igxMask directive is meant to work only with input[type="string"]. It's possible that it will work correctly with other input types but we don't guarantee that. We will document this limitation.

bkulov avatar Apr 26 '18 08:04 bkulov

@SAndreeva @bkulov thank you for explaining. I understand.

I am able to see the limitation in the following document. https://www.infragistics.com/products/ignite-ui-angular/angular/components/mask.html

igxMask directive is used on an input of type text. To get started with the Ignite UI for Angular Mask directive, let's first import the IgxMaskModule and IgxInputGroupModule in our app.module.ts file.

But what about README.md? https://github.com/IgniteUI/igniteui-angular/tree/master/src/directives/mask

tkiryu avatar May 01 '18 23:05 tkiryu

I have updated the README.md file accordingly. Thanks!

SAndreeva avatar May 02 '18 07:05 SAndreeva

@SAndreeva thank you!

tkiryu avatar May 02 '18 08:05 tkiryu