Ionic-framework: Unable to use a "Hardware" keyboard on an ion-input (iOS simulator)

Created on 31 Jan 2017  Â·  10Comments  Â·  Source: ionic-team/ionic-framework

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

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

Current behavior:
I am unable to utilise the "hardware" keyboard when deploying to the iOS simulator which uses an ion-input (in this instance, the hardware is the MacBook's keyboard).

I gather this may well be related to the ionic-plugin-keyboard plugin.

If I uncheck this so the simulator is forced to use the software keyboard, I can focus and type, but this is somewhat painstaking. 🙂

But when I attempt to set focus by clicking, focus is immediately lost and I am unable to type.

Expected behavior:
To be able to use the hardware keyboard, and type without the ion-input losing focus.

Steps to reproduce:

  1. Generate an Ionic v2 project: ionic start -t blank -v IonInputTest && cd IonInputTest
  2. Run the project on an iOS simulator: ionic emulate
  3. Ensure the hardware keyboard is connected: Hardware | Keyboard | Connect Hardware Keyboard.

Related code:
I added this to the bottom of home.page in the Ionic 2 blank starter app:

<ion-list>
  <ion-item>
    <ion-input></ion-input>
  </ion-item>
</ion-list>

Other information:
The input seems to momentarily focus - since if I hammer the mouse/keyboard then I can type a letter or two.

Ion Input issue

Ionic info:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002
reply

Most helpful comment

Omg - after nearly a year of pain and misery pressing each individual key on the iOS simulator, I have found out my issue related to this bug!

The issue was related to Hardware | Keyboard | Toggle Software Keyboard (⌘ + K) - my guess it was disabled. Weirdly, this isn't an issue in a Cordova, non-Ionic app. If you have Connect Hardware Keyboard disabled, the issue persists.

There is a bug in the simulator menu since it does not show a tick next to the option, so you have no way of knowing whether it's enabled/disabled (it also appears disabled in the menu in some instances, unsure why). However, after enabling it via ⌘ + K, it became enabled - still no tick, but I can type!

Keyboard menu

All 10 comments

Hello, thanks for opening an issue with us! Unfortunately I cannot reproduce this issues what version of the iOS sim are you using?

Hi @jgw96 - hmm it seems like the latest one, 5.0.13. Is the input focusing fine for you?

I have the same problem, this is happening only in IOS version 9.3, I downloaded other (8.3) and worked fine, however I am worried about the behaviour in real devices with this versions.

For me it works fine on physical devices. Just not the simulator...

So after testing i can confirm that on both iOS 9.3 and iOS 10.2 on both real iOS devices and the sim's are working fine for me on my machine. Now, i will state that the iOS sim is definitely buggy sometimes, so i would not be surprised if your sim was running into a bug on your machine. For example, the 9.3 sim has a habit of sometimes randomly pinning my cpu to 100% and eventually causing my mac to lock up, you will see me angrily tweet about this sometimes 😆 . Unfortunately though, this is not something that we can solve and instead is something apple would have to solve. Because of this I am going to close this issue for now.

Omg - after nearly a year of pain and misery pressing each individual key on the iOS simulator, I have found out my issue related to this bug!

The issue was related to Hardware | Keyboard | Toggle Software Keyboard (⌘ + K) - my guess it was disabled. Weirdly, this isn't an issue in a Cordova, non-Ionic app. If you have Connect Hardware Keyboard disabled, the issue persists.

There is a bug in the simulator menu since it does not show a tick next to the option, so you have no way of knowing whether it's enabled/disabled (it also appears disabled in the menu in some instances, unsure why). However, after enabling it via ⌘ + K, it became enabled - still no tick, but I can type!

Keyboard menu

confirmed about this with version 11.2 simulator, you still need to uncheck the Connect Hardware Keyboard to make ANY input field working.

@kelvindart's suggestion was right. Connect keyboard should be enabled from hardware menu.
When clicking on an input, the on-screen keyboard opens. When it is open, hitting cmd k once more enables keyboard typing to work!

Also - if you wish to paste from the clipboard, make sure that from Simulator: edit > Automatically sync clipboard is enabled too. Copy something with the usual cmd from anywhere and paste on the device by long-clicking the form. This will bring up the paste menu item.

I've removed floating labels from my forms as well. Using a floating label seems to remove the focus from the forms and as a result - typing using the keyboard doesn't work.

Thank you @kelvindart It works for me too.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danbucholtz picture danbucholtz  Â·  3Comments

masimplo picture masimplo  Â·  3Comments

SebastianGiro picture SebastianGiro  Â·  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  Â·  3Comments

alan-agius4 picture alan-agius4  Â·  3Comments