Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionic 2: ion-searchbar doesn't open search keyboard on iOS #7484

Closed
mbrookson opened this issue Jul 30, 2016 · 4 comments
Closed

ionic 2: ion-searchbar doesn't open search keyboard on iOS #7484

mbrookson opened this issue Jul 30, 2016 · 4 comments
Assignees

Comments

@mbrookson
Copy link

mbrookson commented Jul 30, 2016

On iOS, using the ion-searchbar component doesn't open the search keyboard type.

I have done some reading and seem to have found that since iOS 8, <input type="search" /> needs to be wrapped in a <form> tag for the correct keyboard to be displayed.

You can fix this keyboard issue like so:

<ion-toolbar>
  <form>
    <ion-searchbar class="product-searchbar" [type]="search" (ionInput)="searchByTerm($event, searchTerm)" [(ngModel)]="searchTerm" [debounce]="800" [showCancelButton]="true"></ion-searchbar>
  </form>
</ion-toolbar>

However, this then leads to another issue which is that the Search button on the native keyboard then triggers the cancel event and doesn't close the keyboard by default, see #7010

Would be great to see this in the next release since it seems like the search doesn't quite contain full search functionality

Thanks!

@manucorporat
Copy link
Contributor

@mbrookson I will close this as a "won't fix" since we can't include a <form> inside <ion-searchbar> because it could break tons of existing implementations.

However, this then leads to another issue which is that the Search button on the native keyboard then triggers the cancel event and doesn't close the keyboard by default, see #7010

^ this will be fixed next version! so no problem to use <ion-searchbar> inside your own <form>.

@arturalkaim
Copy link

Hi!
I'm having this issue with the ion-searchbar.
The keyboard just don't go away, with or without a surrounding <form>.

No answer for this.keyboard.close(); and console.log("keyboard open:", this.keyboard.isOpen()); always prints true.

Any info that could fix this?

Your system information:
Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.6
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.1
ios-deploy version: 1.9.0 
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002

@anjum121
Copy link

        <form action=".">
                <ion-searchbar
                        [(ngModel)]="searchKey"
                        [ngModelOptions]="{standalone: true}"
                        [showCancelButton]="true"
                        (search)="searchWithKeyword(activeTab)"
                        (ionCancel)="onCancel($event)"
                        [placeholder]="somePlaceHolder"
                        [animated]="false"
                        [value]=""
                        name="search"
                >
                </ion-searchbar>
            </form>

I have used form with action="." which is working

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 4, 2018

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants