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

feat: Reorder button pushes label text out of the list

Open Justin-Credible opened this issue 12 years ago • 9 comments

Type: feat

Platform: all

The default behavior of the list control (as far as I can tell) pushes the label text of the list items off of the left side when the re-order button is present. I can understand moving the label text to the right when the delete button is shown is important, but when the re-order button becomes visible, it causes the label text to be cut off on the left side of the list item.

This is a problem for me because we need to have a list whose items always have the re-order button visible (not conditionally enabled) and this makes it impossible to read the item text because it will always be cut off.

This is easy to see on the default sample for the list by simply clicking the re-order button: http://codepen.io/ionic/pen/JsHjf

Is there a way to prevent the item text from being pushed off of the left side of the list item when the re-order button is visible?

Justin-Credible avatar Aug 07 '14 19:08 Justin-Credible

I'm facing the same problem. Additionally:-

  1. Both reorder and delete buttons cannot be visible at the same time. In iOS, there are cases Apple uses this presentation approach, for example when editing the contacts favorites list.
  2. If the reorder button is always visible, then the form inputs are disabled (if there are any within the list item), practically making it not possible to have such UI design.

It would be nice if flexibility could be provided in these cases so that such design decisions are left to the users of the framework.

zapatek avatar Aug 08 '14 03:08 zapatek

Hey guys so this was done via https://github.com/driftyco/ionic/commit/4f10a72306e2b3b1f70097edf0f7872946198660

The purpose was to make sure that the reordering animation was much more performant on a winder range of devices. If you tried to toggle reordering on a device, the animation became choppy because it wasn't hardware accelerated.

The way it is now provides a much more smoother animation that works great on all devices.

mhartington avatar Aug 12 '14 19:08 mhartington

So this is working as intended? There is no way to have a list that is in re-order mode from the start without toggling re-order mode on and not having cut off text (other than using CSS hacks)?

Not trying to be argumentative here, just want to confirm before we start using CSS left margins to keep the text visible on all of our lists with re-ordering enabled.

Thanks!

Justin-Credible avatar Aug 15 '14 17:08 Justin-Credible

If you want, you can override the default animations that we changed in https://github.com/driftyco/ionic/commit/4f10a72306e2b3b1f70097edf0f7872946198660, changing them back, but the performance will suffer and be very choppy on an actual device

mhartington avatar Aug 15 '14 18:08 mhartington

Just in case anybody else finds this thread-- this is the problem we were having. Notice that the "Item" part of all the items are cut off and you can only see the number part when the re-order buttons are visible.

problem

<ion-list show-reorder="true">
    <ion-item ng-repeat="item in viewModel.items">
        <span>{{item.name}}</span>
        <ion-reorder-button class="ion-navicon"></ion-reorder-button>
    </ion-item>
</ion-list>

We worked around this problem by adding an icon for each row and adding a left margin of 50px to the icon as well as the span that contained the text.

fixed

<ion-list show-reorder="true">
    <ion-item class="item-icon-left" ng-repeat="item in viewModel.items">
        <i class="icon ion-{{item.icon}}" style="margin-left: 50px;"></i>
        <span style="margin-left: 50px;">{{item.name}}</span>
        <ion-reorder-button class="ion-navicon"></ion-reorder-button>
    </ion-item>
</ion-list>

Justin-Credible avatar Aug 15 '14 21:08 Justin-Credible

I have the exact same issue and I just can't believe that this is the way it's supposed to work.

If the label is any shorter then the 'Item X' in the demo it becomes basically unusable! The User can't see what he is reordering, since the whole label is pushed off the list...

It's in all versions here: http://ionicframework.com/docs/nightly/api/directive/ionList/

eburi avatar Oct 02 '14 16:10 eburi

I got tired of this behavior, so I wrapped the content of the list item in a span and added some CSS:

<ion-item ng-repeat="item in items">
  <span class="reorder-adjusted">{{ item.name }}</span>
  <ion-option-button class="button-assertive" ng-click="delete(item)">Delete</ion-option-button>
  <ion-reorder-button class="ion-navicon" on-reorder="reorder(item, $fromIndex, $toIndex)"></ion-reorder-button>
</ion-item>
.list .item-content .reorder-adjusted {
  display: inline-block;
  -webkit-transition-duration: 250ms;
  transition-duration: 250ms;
  -webkit-transition-timing-function: ease-in-out;
  transition-timing-function: ease-in-out;
  -webkit-transition-property: -webkit-transform;
  -moz-transition-property: -moz-transform;
  transition-property: transform;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.list.list-right-editing .item-content .reorder-adjusted {
  -webkit-transform: translate3d(50px, 0, 0);
  transform: translate3d(50px, 0, 0);
}

Maybe you'll find this workaround useful.

broberson avatar Dec 25 '14 08:12 broberson

Thanks @broberson

Yuripetusko avatar Jan 14 '15 12:01 Yuripetusko

@broberson I have a simpler fix.

.list-right-editing .item-right-editable .item-content, .item-right-editing.item-right-editable .item-content {
    -webkit-transform: none;
    transform: none;
}

chasys avatar Mar 12 '15 18:03 chasys