Skip to content

Ionic 4 - iOS accessory bar next/previous buttons disabled using ion-item #16498

Closed

Description

@KevinKelchen

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:

  1. Start a new project with ionic start keyboard blank --type=angular.
    • Note: You may need to edit the package.json to upgrade it from Ionic 4 RC1 to RC2 if the starter templates have not yet been updated for RC2.
  2. Path into the project directory and run ionic cordova prepare ios. Say Y to the prompt to install the iOS platform. cordova-plugin-ionic-webview should then be added to the project.
  3. Run ionic cordova prepare ios again. It will download/install the Cordova plugins that are part of the template.
  4. In app.component.ts after the platform is ready and when the StatusBar and SplashScreen plugins are being used, add the following line to enable the keyboard accessory bar:
(window as any).Keyboard.hideFormAccessoryBar(false);
  1. In home.page.html inside of ion-content add some adjacent ion-input elements as well as some adjacent native HTML input elements 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>
  1. Run ionic cordova run ios --device. This will build the app and deploy it to a device.
  2. When the app is up and running on the device, tap on the first native HTML input element 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 native input element. Tap the next button on the keyboard accessory bar to move to the second input element. You'll see the previous button also enable so you can move to the previous input.
  3. With focus on the second native input element, tap the next button on the keyboard accessory bar. Notice that you jump over both the native input as well as the ion-input elements that are child to the ion-item element. The element that is in focus is actually the first of the two ion-inputs that are direct children to ion-content. You can then also use the keyboard accessory bar's next button to navigate to the second ion-input that's a direct child to ion-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

  1. paulstelzer commented on Dec 4, 2018

    @paulstelzer
    Contributor

    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?

  2. added
    needs: reply
    on Dec 4, 2018
  3. KevinKelchen commented on Dec 4, 2018

    @KevinKelchen
    Author

    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-input was somewhat re-written in v4 (Angular ➡️ Stencil) so there could be greater potential for bugs given the churn), or something in the cordova-plugin-ionic-keyboard Cordova 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 Done button. 🙂 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!

  4. added and removed
    needs: reply
    on Dec 4, 2018
  5. added
    package: core
    help wanted
    and removed
    package: core
    on Dec 4, 2018
  6. paulstelzer commented on Dec 4, 2018

    @paulstelzer
    Contributor

    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/core or the Ionic cordova keyboard plugin :)

  7. 19 remaining items

  8. manish-sh14 commented on Nov 15, 2019

    @manish-sh14

    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.

  9. cyptus commented on Nov 15, 2019

    @cyptus

    @liamdebeasi may you got infos about this liam?

  10. justjoeyuk commented on Nov 21, 2019

    @justjoeyuk

    This is quite a big issue...

  11. liamdebeasi commented on Nov 21, 2019

    @liamdebeasi
    Contributor

    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-input elements in each of their own separate ion-item elements causes this issue to occur.

    I will provide an update here when I have more to share. Thanks!

  12. visant commented on Jan 29, 2020

    @visant

    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.

  13. liamdebeasi commented on Jan 29, 2020

    @liamdebeasi
    Contributor

    Removing ion-item from 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.

  14. ipehimanshu commented on Apr 22, 2020

    @ipehimanshu

    @liamdebeasi
    is there any update for this issue ?

    because this is still issue in latest

    ionic/angular 5.0.7

  15. added
    package: core
    type: bug
    and removed on Apr 29, 2020
  16. liamdebeasi commented on Apr 29, 2020

    @liamdebeasi
    Contributor

    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!

  17. locked and limited conversation to collaborators on Apr 29, 2020
  18. liamdebeasi commented on Feb 2, 2021

    @liamdebeasi
    Contributor

    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.

  19. liamdebeasi commented on Apr 20, 2021

    @liamdebeasi
    Contributor

    Hi there,

    iOS 14.5 just shipped, and it includes a fix for this issue.

    Thanks for everyone's patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions