title: Ionic 4: How to Suppress Click action on <ion-sliding-item> when items are open?
body: <p>I'm using an <code>&lt;ion-list&gt;</code> with <code>&lt;ion-sliding-item&gt;</code>'s. The inner item has a <code>(click)</code> event <code>(click)="goToDetail(message.id)"</code>.  </p>
  
  <pre><code>&lt;ion-list #messageList&gt;
      &lt;ion-item-sliding *ngFor="let message of messages"&gt;
          &lt;ion-item detail (click)="goToDetail(message.id)"&gt;
              &lt;ion-label&gt;
                  {{ message.text }}
              &lt;/ion-label&gt;
          &lt;/ion-item&gt;
          &lt;ion-item-options&gt;
              &lt;ion-item-option (click)="confirmDelete(message.id)"&gt;Delete&lt;/ion-item-option&gt;
          &lt;/ion-item-options&gt;
      &lt;/ion-item-sliding&gt;
  &lt;/ion-list&gt;
  </code></pre>
  
  <p>Normally, when the item is clicked, I want the click event to fire.</p>
  
  <p>However, if I slide one of the items, revealing the 'Delete' option, then click on a different item, the sliding item closes, then the (click) event  of the other item is fired.</p>
  
  <p><a href="https://i.stack.imgur.com/hnmaK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hnmaK.png" alt="screenshot of slider open revealing delete option"></a></p>
  
  <p>I want to prevent this click event.  I've read the <a href="https://ionicframework.com/docs/api/list#methods" rel="nofollow noreferrer">documentation</a> and see the <code>&lt;ion-list&gt;</code> has a <code>closeSlidingItems()</code> method.  So, I was hoping I could simply change my click event to something like:</p>
  
  <pre><code>(click)="messageList.closeSlidingItems() || goToDetail(message.id)"
  </code></pre>
  
  <p>But, the closeSlidingItems() method returns a promise, not a boolean.  Okay, no problem, I thought to just wrap my <code>goToDetail()</code> function with this check.</p>
  
  <pre><code>public goToDetail(threadId) {
      this.messageList.closeSlidingItems()
          .then(sliderWasClosed =&gt; {
              if (!sliderWasClosed) {
                  this.nav.navigateForward('app/conversation/' + threadId);
              }
          });
  }
  </code></pre>
  
  <p>However, what I'm finding is that the promise always returns <code>false</code>, even when a sliding item is in fact closed.  I suspect this is because the close operation happens automatically and by the time my function is called, the item is already closed.</p>
  
  <p>My overall goal is to prevent the <code>(click)</code> event when sliders are open.  My current code would work if the <code>closeSlidingItems()</code> method would return the proper value.</p>
  
  <p>Is there a way I can prevent this automatic closing of sliding items in order to get the correct result when I call <code>closeSlidingItems()</code> myself?</p>
  
  <p>Is there another event I should be using besides <code>(click)</code> ?</p>
  
  <p>Any other ideas how I can get this to work?</p>
  
  <p><a href="https://stackblitz.com/edit/ionic-close-sliding-items-always-returns-false-on-click" rel="nofollow noreferrer">StackBlitz of issue</a></p>