Repository navigation
Description
Bug Report
Ionic Info
Ionic:
ionic (Ionic CLI) : 4.6.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-rc.2
@angular-devkit/build-angular : 0.12.2
@angular-devkit/schematics : 7.2.2
@angular/cli : 7.2.2
@ionic/angular-toolkit : 1.2.2
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 4 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/kelchen/Library/Android/sdk)
ios-deploy : 2.0.0
ios-sim : 7.0.0
NodeJS : v10.13.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61
Describe the Bug
When using the cordova-plugin-ionic-keyboard Cordova plugin on iOS with the keyboard accessory bar enabled, the next and previous buttons of the accessory bar are disabled for navigating between form inputs that are not child to the same ion-item element.
Steps to Reproduce
Steps to reproduce the behavior:
- Start a new project with
ionic start keyboard blank --type=angular.- Note: You may need to edit the
package.jsonto upgrade it from Ionic 4 RC1 to RC2 if the starter templates have not yet been updated for RC2.
- Note: You may need to edit the
- Path into the project directory and run
ionic cordova prepare ios. SayYto the prompt to install the iOS platform.cordova-plugin-ionic-webviewshould then be added to the project. - Run
ionic cordova prepare iosagain. It will download/install the Cordova plugins that are part of the template. - In
app.component.tsafter the platform is ready and when theStatusBarandSplashScreenplugins are being used, add the following line to enable the keyboard accessory bar:
(window as any).Keyboard.hideFormAccessoryBar(false);- In
home.page.htmlinside ofion-contentadd some adjacention-inputelements as well as some adjacent native HTMLinputelements like this:
<ion-content padding>
The world is your oyster.
<p>If you get lost, the <a target="_blank" rel="noopener" href="https://beta.ionicframework.com/docs/">docs</a> will be your guide.</p>
<input />
<input />
<ion-item>
<input />
<ion-input></ion-input>
</ion-item>
<ion-input></ion-input>
<ion-input></ion-input>
</ion-content>- Run
ionic cordova run ios --device. This will build the app and deploy it to a device. - When the app is up and running on the device, tap on the first native HTML
inputelement to put focus in the input. The keyboard will open. Notice on the keyboard accessory bar that the next button can be used to navigate to the second nativeinputelement. Tap the next button on the keyboard accessory bar to move to the secondinputelement. You'll see the previous button also enable so you can move to the previous input. - With focus on the second native
inputelement, tap the next button on the keyboard accessory bar. Notice that you jump over both the nativeinputas well as theion-inputelements that are child to theion-itemelement. The element that is in focus is actually the first of the twoion-inputs that are direct children toion-content. You can then also use the keyboard accessory bar's next button to navigate to the secondion-inputthat's a direct child toion-content.
Related Code
The steps to reproduce above should be all that you need (using the starter template and following the steps).
Expected Behavior
I expected to be able to use the iOS keyboard accessory bar previous/next buttons to navigate between form inputs that are not child to the same ion-item element, which I could do in Ionic 3.
Additional Context
Originally this issue focused on the Shadow DOM of ion-input contributing to the keyboard next/previous buttons not working; ion-item wasn't in the initial sample to reproduce or noted as being a contributing factor. With Shadow DOM being removed on ion-input in RC2 I tried once again.
While the initial sample to reproduce then worked, our application did not. I determined this is because in our application we wrap our ion-input elements with ion-item elements. I've updated this issue accordingly.
Activity
paulstelzer commentedon Dec 4, 2018
Thanks for reporting the issue :) Ionic uses shadow dom so I think you have to write this logic yourself. Or do you have an idea to fix it?
KevinKelchen commentedon Dec 4, 2018
Thanks for responding, @paulstelzer! 🙂
At this point I do not know how to resolve the issue. I am not sure if the problem is due to ShadowDOM, another reason in Ionic 4 (e.g.,
ion-inputwas somewhat re-written in v4 (Angular ➡️ Stencil) so there could be greater potential for bugs given the churn), or something in thecordova-plugin-ionic-keyboardCordova plugin; ShadowDOM is just my suspicion. I have not dug in to confirm what the underlying issue is. Have you done so? At this point I've only submitted the issue figuring those who better understand Ionic would be more efficient and effective assessing the cause and potential solutions.If I were to start looking into it myself I would probably try to understand how the keyboard determines it needs to enable/disable the next/previous buttons. Not sure if that would be in the plugin code or is something internal to Apple's keyboard. I will try taking a look and can see where I get, but I would appreciate help from anyone more knowledgeable.
I would expect this functionality to be supported out of the box as it involves Ionic's own keyboard plugin supporting Ionic's own, most basic, Ionic form element, rather than logic each user's application would be required to implement if they want two-thirds of the accessory bar functions to work and for the bar to do anything besides provide a
Donebutton. 🙂 However, if it's determined that the logic belongs in the application code instead of the framework/plugin, does someone have an example or ideas they are willing to share?Thank you!
paulstelzer commentedon Dec 4, 2018
Mh, good question, but I cannot answer it right now. I label it as help wanted, maybe someone with more knowledge than we both has an idea if this is possible in
@ionic/coreor the Ionic cordova keyboard plugin :)19 remaining items
manish-sh14 commentedon Nov 15, 2019
even i am looking into this, did not get the solution yet. next/previous button won't work on ion-input if its wrap in ion-item.
cyptus commentedon Nov 15, 2019
@liamdebeasi may you got infos about this liam?
justjoeyuk commentedon Nov 21, 2019
This is quite a big issue...
liamdebeasi commentedon Nov 21, 2019
Thanks for the issue. Wanted to provide a brief update here.
This is a known issue in Webkit/Safari. We have reported the issue to the WebKit team (https://bugs.webkit.org/show_bug.cgi?id=203292), and they are aware of the issue and are investigating. The issue stems from having inputs in the shadow DOM. In the case of Ionic, putting
ion-inputelements in each of their own separateion-itemelements causes this issue to occur.I will provide an update here when I have more to share. Thanks!
visant commentedon Jan 29, 2020
Can you not just change the shadow property to the scope property in the ion-item, as you have done it for #17020 (PR #17043)? I believe the issue here very is similar.
liamdebeasi commentedon Jan 29, 2020
Removing
ion-itemfrom the Shadow DOM would result in features being lost from the component (such as slots), and I do not think that is a good trade off.ipehimanshu commentedon Apr 22, 2020
@liamdebeasi
is there any update for this issue ?
because this is still issue in latest
ionic/angular 5.0.7
liamdebeasi commentedon Apr 29, 2020
Hi everyone,
We are waiting on the WebKit team to resolve this issue. I am going to lock this thread for now since we have all the required information we need, but I will post an update here when this is resolved from the WebKit side. Thanks!
liamdebeasi commentedon Feb 2, 2021
Hi everyone,
I can confirm that this issue is resolved in iOS 14.5 beta 1. I will follow up here when iOS 14.5 ships for all iOS users.
liamdebeasi commentedon Apr 20, 2021
Hi there,
iOS 14.5 just shipped, and it includes a fix for this issue.
Thanks for everyone's patience!