Hide keyboard on menu button click


#1

Hello

I’m trying to disable the keyboard from showing everytime I click on the side menu button. I have a text box that is in my side menu that appears to be getting focus.

What would be the best way to suppress this behavior? Here is a picture.

my snippet

<ion-side-menus>

  <ion-pane ion-side-menu-content>
    <ion-nav-bar class="bar-smash nav-title-slide-ios7">
      <ion-nav-back-button class="button-clear" ><i class="icon ion-ios7-arrow-back" id="menuBtn"></i> Back</ion-nav-back-button>
    </ion-nav-bar>
    <ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
  </ion-pane>

  <ion-side-menu side="left">
    <header class="bar bar-header bar-smash">
     
      <label class="item-input searchbox">
        <i class="icon ion-search placeholder-icon"></i>
        <input type="text" placeholder="Search">
      </label>
    
    </header>

thanks.


#2

Check out the keyboard plugin docs…


#3

Yeah, I tried that. it doesnt appear to stay suppressed, I’ve even gone as far to blur the text box to try to prevent it, am I missing something?

My controller function

$scope.kbHide =   function() {
    angular.element(document.querySelector('#searchbox')).blur();
    cordova.plugins.Keyboard.close();
  }

and my button ng-click

<button menu-toggle="left" class="button button-icon icon ion-navicon" ng-click="kbHide()"></button>

#4

Ionic Team -

How do you think I should tackle my issue? Did you see my reply? I’m doing everything i can think of to force it down, but based on the location of the text box nothing seems to work.

Any ideas?

thanks


#5

Do you ever get any response on this? I have the same issue.


#6

Unfortunately I did not. I have a work around for now, which is putting some sort of design element at the top, and the search box just below it. It still gets triggered but not as often.

Keep me posted if figure something else out.

Matt


#7

I have a solution. I set the attribute “disabled” on the input. I then re-enable the field on touch. I keep the field disabled on menu touch by sending an event that the controller of my side menu listens to and resets disabled=true.

Seems to work.


#8

oh, thats a good idea, so you really dont have an issue do you, or do you just not like the work around?


#9

I no longer have an issue. I don’t believe ionic should work this way but I have a working solution.


#10

Emg -

what does your listener look like? I’m having a heck of time.