Skip to content

bug: ion-input with type number throws error on value change #24753

@AlessandroFBK

Description

@AlessandroFBK

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behaviour

Given an ion-input with type number

<ion-input
  inputmode="decimal"
  type="number"
></ion-input>

the following error is thrown on each value change:

Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

I notice that version 6.0.6 has recently changed the code that performs setSelectionRange on input element (link).

The bug does not occur on previous version (6.0.5).

Expected Behavior

Typing in an ion-input with type number should not result into an error.

Steps to Reproduce

In an Angular application, add

<ion-input
  inputmode="decimal"
  type="number"
></ion-input>

Then type some value in the input element and check out the console log.

Code Reproduction URL

GitHub repository

Ionic Info

Ionic:

   Ionic CLI                     : 6.18.1 (/home/alessandro/.nvm/versions/node/v16.11.1/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.0.6
   @angular-devkit/build-angular : 12.2.12
   @angular-devkit/schematics    : 12.2.16
   @angular/cli                  : 12.2.16
   @ionic/angular-toolkit        : 5.0.3

Capacitor:

   Capacitor CLI      : 3.4.0
   @capacitor/android : 3.4.0
   @capacitor/core    : 3.4.0
   @capacitor/ios     : 3.4.0

Utility:

   cordova-res (update available: 0.15.4) : 0.15.3
   native-run                             : 1.5.0

System:

   NodeJS : v16.11.1 (/home/alessandro/.nvm/versions/node/v16.11.1/bin/node)
   npm    : 8.0.0
   OS     : Linux 5.4

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions