ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: can slide item even without option buttons

Open brandyscarney opened this issue 10 years ago • 4 comments

If there is a *ngIf on a button in ion-item-options then when the ngIf evaluates to false you can still swipe the item and see an empty white space:

<ion-item-options>
  <button favorite (click)="addFavorite(slidingItem, session)" *ngIf="segment === 'all'"> 
    Favorite
  </button>
</ion-item-options>

& if you put it on the ion-item-options you can't slide at all even when it evaluates to true.

image:

screen shot 2016-01-25 at 3 49 55 pm

brandyscarney avatar Jan 25 '16 20:01 brandyscarney

I had the same problem. As temporary fix you could remove if (!itemData.optsWidth) { check in item-sliding-gesture as it caches swiping offset. I'm not sure if that is correct fix to the associated bug as it may be not as efficient as possible.

kamiua avatar Mar 12 '16 21:03 kamiua

@brandyscarney I think this should be fixed in my PR. I will test more in detail.

manucorporat avatar Jun 06 '16 14:06 manucorporat

@brandyscarney @adamdbradley before finding a fix for this, I am not sure how an empty ion-item-options, should behave.

I agree, ion-item-options should be able to adapt at runtime if the buttons change, but an empty ion-item-options does not make a lot of sense.

Maybe it should be refactored to:

<ion-item-options *ngIf="segment === 'all'">
  <button favorite (click)="addFavorite(slidingItem, session)"> 
    Favorite
  </button>
</ion-item-options>

I think an empty ion-item-options should slide (with an elastic effect).

manucorporat avatar Jun 08 '16 19:06 manucorporat

@manucorporat That makes sense actually. I swear at one point that didn't work...I imagine I would've tried that haha. I'm ok with moving the ngIf to the options element as a solution.

brandyscarney avatar Jun 08 '16 19:06 brandyscarney