material icon indicating copy to clipboard operation
material copied to clipboard

Ui-sref on list item breaks design

Open ghost opened this issue 11 years ago • 11 comments

When using ui-sref instead of ng-click od list item, design is broken.

ghost avatar Nov 07 '15 17:11 ghost

workaround: use ng-click with $state.go

jpike88 avatar Nov 09 '15 01:11 jpike88

By doing that i'm loosing benefits like (open in new tab, open in new window...etc)

ghost avatar Nov 09 '15 06:11 ghost

I've also seen this issue on md-buttons when using an icon. The icon reliably appears above center from what I have seen off-center-fab-icon

TheRealBryon avatar Nov 10 '15 14:11 TheRealBryon

Still not fixed in rc4

ghost avatar Nov 16 '15 09:11 ghost

I believe I am experiencing the same issue. I will provide additional detail.

In commit f8a8b3c md-list-item was fixed so that ui-sref attributes were recognised for compatibility with angular-ui-router. This was done to match the behaviour when a ng-click attribute is added to a md-list-item: you get a cursor on hover, and a ripple on click.

Currently, when I add an ui-sref attribute to a md-list-item, I can see that a nested anchor is created with the class md-button. The issue is that the anchor has horizontal margins of 8px and vertical margins of 6px. Thus, the ripple does not extend to the edges of the md-list-item. This is inconsistent with the behaviour of adding an ng-click attribute which does not result in these margins.

I suspect that the likely culprit is the md-button class which is added to the anchor. It adds the horizontal and vertical margins.

Supratentorial avatar Nov 25 '15 08:11 Supratentorial

+1 for this.

My solution was to add to my styling.

md-list-item {
    > a {
        margin: 0 !important;
    }
}

ruant avatar Jan 17 '16 15:01 ruant

+1! Not being allowed to use ui-sref brings a lot of headaches. If we use ng-click with $state.go then we can't use ui-sref-active to highlight the active item, then we need to manually check the current state and do all the logic that ui-sref-active does. We need to do a lot of workaround for something that should be simple.

kaumac avatar Feb 03 '16 23:02 kaumac

@kaumac @gpopovic I'm trying to dive into this, but I can't reproduce the actual problem in master. Can someone of you create a little demo? (codepen etc.)

devversion avatar Feb 13 '16 12:02 devversion

@DevVersion I think the problem is the following: http://codepen.io/gustavohenke/pen/NxVBqM

gustavohenke avatar Feb 19 '16 16:02 gustavohenke

@gustavohenke Your demo isn't showing any issue, but I took the time to built it myself.

  • http://codepen.io/DevVersion/pen/wMLNOJ

I think I can see what the issue is.

devversion avatar Feb 22 '16 18:02 devversion

Update

  • There is already a PR pending, which is fixing that issue. See #6496

devversion avatar Feb 22 '16 18:02 devversion