ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Tabbing from ion-input to ion-datetime throws exception

Open imgx64 opened this issue 10 years ago • 41 comments

Ionic version: (check one with "x") [x] 2.x

I'm submitting a ... (check one with "x") [x] bug report

Current behavior: When an <ion-input> is followed by an <ion-datetime> in a list, pressing Tab throws the below exception:

Runtime Error
Error in ./TextInput class TextInput - caused by: nextInput.initFocus is not a function
Stack
TypeError: nextInput.initFocus is not a function
    at Form.tabFocus (...\ionic-demo\node_modules\ionic-angular\util\form.js:35:34)
    at eval (...\ionic-demo\node_modules\ionic-angular\components\input\input-base.js:153:29)
    at SafeSubscriber.schedulerFn [as _next] (...\ionic-demo\node_modules\@angular\core\src\facade\async.js:101:36)
    at SafeSubscriber.__tryOrUnsub (...\ionic-demo\node_modules\rxjs\Subscriber.js:223:16)
    at SafeSubscriber.next (...\ionic-demo\node_modules\rxjs\Subscriber.js:172:22)
    at Subscriber._next (...\ionic-demo\node_modules\rxjs\Subscriber.js:125:26)
    at Subscriber.next (...\ionic-demo\node_modules\rxjs\Subscriber.js:89:18)
    at EventEmitter.Subject.next (...\ionic-demo\node_modules\rxjs\Subject.js:55:25)
    at EventEmitter.emit (...\ionic-demo\node_modules\@angular\core\src\facade\async.js:81:76)
    at NextInput.receivedFocus (...\ionic-demo\node_modules\ionic-angular\components\input\native-input.js:167:22)

Expected behavior: Not throwing an exception.

Steps to reproduce:

  1. Create a new Ionic v2 project
  2. Paste the below code in src/pages/home/home.html
  3. Run ionic serve and open in browser
  4. Click on 'Name'
  5. Press Tab
<ion-content padding>
  <ion-list>
    <ion-item>
      <ion-label floating>Name</ion-label>
      <ion-input type="text"></ion-input>
    </ion-item>

    <ion-item>
      <ion-label floating>Date of Birth</ion-label>
      <ion-datetime></ion-datetime>
    </ion-item>
  </ion-list>
</ion-content>

For some reason, I can't reproduce it on Plunker.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Your system information:

 ordova CLI: 6.4.0
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v4.6.1
Xcode version: Not installed

imgx64 avatar Nov 24 '16 08:11 imgx64

The same thing happens if you use <ion-select> and <ion-checkbox> (and possibly other input components) instead of <ion-datetime>.

It also happens if the <ion-datetime> is the first item, and you press Tab from the last item.

imgx64 avatar Nov 24 '16 09:11 imgx64

I have same problem with RC3, when tabbing from ion-input to ion-select. Please help Ionic Team. The problem never existed in RC2?

gunterberger avatar Nov 27 '16 10:11 gunterberger

Same, tabbing from input to toggle error_handler.js:48 EXCEPTION: Error in ./TextArea class TextArea - inline template:0:184 caused by: nextInput.initFocus is not a function

Not sure if related, but when I scroll while having focus in a textarea/ input, that textarea/input gets duplicated while scrolling.

corey-garvin avatar Dec 13 '16 22:12 corey-garvin

I had this issue with ion-checkbox under 2.0.0-rc.3, but it seems to be fixed in 2.0.0-rc.4! Give it a shot and let us know if it's fixed for the ion-datetime too.

petrkotek avatar Dec 18 '16 03:12 petrkotek

I have never had this issue until I updated to rc4 and now I am getting it on my ion-input, tab or not just leaving the textbox throws the error. However it is a different end error I guess.

Error in ./TextInput class TextInput - caused by: Cannot read property '_platform' of undefined

Ionic Framework: 2.0.0-rc.4-201612192257 Ionic Native: ^2.2.12 Ionic App Scripts: 0.0.48 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 7.2.1 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

This seems to be in the nightly version only, I went back to just RC4 and it works again.

glashtin avatar Dec 20 '16 16:12 glashtin

Same here with a <ion-input> followed by a <ion-datetime>

Runtime Error
Error in ./TextInput class TextInput - caused by: nextInput.initFocus is not a function

TypeError: nextInput.initFocus is not a function
    at Form.tabFocus (http://localhost:8100/build/main.js:9295:34)
    at http://localhost:8100/build/main.js:107010:29
    at SafeSubscriber.schedulerFn [as _next] (http://localhost:8100/build/main.js:38411:36)
    at SafeSubscriber.__tryOrUnsub (http://localhost:8100/build/main.js:1327:16)
    at SafeSubscriber.next (http://localhost:8100/build/main.js:1276:22)
    at Subscriber._next (http://localhost:8100/build/main.js:1229:26)
    at Subscriber.next (http://localhost:8100/build/main.js:1193:18)
    at EventEmitter.Subject.next (http://localhost:8100/build/main.js:4464:25)
    at EventEmitter.emit (http://localhost:8100/build/main.js:38391:76)
    at NextInput.receivedFocus (http://localhost:8100/build/main.js:44069:22)
Ionic Framework: 2.0.0-rc.4
Ionic Native: 2.2.11
Ionic App Scripts: 0.0.47
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 4.2.6
OS Platform: Linux 4.4
Navigator Platform: Linux x86_64
User Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.23 Mobile Safari/537.36

vigohe avatar Dec 26 '16 18:12 vigohe

I'm seeing this as well on -rc.4.

morrisonbrett avatar Jan 03 '17 00:01 morrisonbrett

ionic serve --lab tab pressed to move next input element throw this error. I also have the same problem. Anybody have the solution to resolve it.

farhaan008 avatar Jan 07 '17 13:01 farhaan008

I'm getting this on 2.0.0-rc.5 When tabbing from an ion-input to an ion-select

tmzblue avatar Jan 12 '17 22:01 tmzblue

Also having this issue in version: 2.0.0-rc.3

IlhamiD avatar Jan 12 '17 22:01 IlhamiD

Yep. Problem is still there in -rc.5.

morrisonbrett avatar Jan 12 '17 23:01 morrisonbrett

Also having this issue in version: 2.0.0-rc.3

Baadier-Sydow avatar Jan 13 '17 08:01 Baadier-Sydow

Can anyone fix this or is there any workaround?

IlhamiD avatar Jan 13 '17 21:01 IlhamiD

It's still there in -rc.5 if you run the app in mobile browser (iOS 10, both chrome and safari in my case). Other platform/browser not tested yet.

theflyingwolves avatar Jan 16 '17 03:01 theflyingwolves

Just so you know (I don't mean to bump this thread, only thought it was important)

This also happens if you are using the Keyboard.hideKeyboardAccessoryBar(false) (AKA, if you're using the accessory bar to navigate inputs and the input attempts to select a ion-datetime).

ghost avatar Feb 04 '17 15:02 ghost

I'm also seeing this as well :/

anthony-ngu avatar Feb 10 '17 03:02 anthony-ngu

I had the same issue until I used the inputs inside of a form. https://ionicframework.com/docs/v2/resources/forms/

jayordway avatar Feb 12 '17 08:02 jayordway

I got same issue now.

andyngdz avatar Feb 22 '17 16:02 andyngdz

Also having this issue in version: 2.2.1

vicenterusso avatar Feb 23 '17 17:02 vicenterusso

I'm having this issue too, is there a workaround? Maybe implementing a stub method for nextInput.initFocus?

Your system information:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.11 
OS: macOS Sierra
Node Version: v7.0.0
Xcode version: Xcode 8.1 Build version 8B62

CraigHarley avatar Feb 27 '17 22:02 CraigHarley