Skip to content

bug: “active” class does not work in <ion-item href=“”> #3050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sgon00 opened this issue Feb 7, 2015 · 3 comments
Closed

bug: “active” class does not work in <ion-item href=“”> #3050

sgon00 opened this issue Feb 7, 2015 · 3 comments
Assignees
Milestone

Comments

@sgon00
Copy link

sgon00 commented Feb 7, 2015

Type: bug

Platform: all

Please check the code:
http://codepen.io/anon/pen/PwOQwR

<ion-item class="item-dark active" nav-clear ng-click="login()">
 Login
</ion-item>
<ion-item class="item-dark active" nav-clear href="#">
Browse
</ion-item>

active class works when the <ion-item> does not have href attribute.
When <ion-item> has the href attribute, it will add <a> inside ion-item and <a>'s background color will override active background color with:

.item-complex.item-dark > .item-content {
  border-color: #111;
  background-color: #444;
  color: #fff;
}

To workaround this issue, I have to add the following css style to override <a> background color again:

.item-complex.item-dark.active > .item-content {
    border-color: #000;
    background-color: #262626;
}
@sgon00 sgon00 changed the title “active” class does not work in <ion-item href=“”> bug: “active” class does not work in <ion-item href=“”> Feb 7, 2015
@adamdbradley adamdbradley self-assigned this Feb 12, 2015
@djett41
Copy link

djett41 commented Feb 24, 2015

I believe this is related to the same issue I was seeing. In beta 14, line 3100 of ionic.js, the ionic.activator.start is supposed to be checking for elements with .item class when it walks up parents, but eleToActive will ALWAYS be undefined in this condition so the check will never pass...

Therefore to get the activated class added to your item, your ion-item will have to have an ng-click which would pass the third condition.

@mhartington
Copy link
Contributor

@sgon00 it does work, it may just be a bug with the colored items (positive, calm, dark)

http://codepen.io/mhartington/pen/bNMXbZ

Notice that a normal item accepts the active class without any issues.
Will look into this more.

@mhartington mhartington added this to the 1.0.2 milestone Jul 14, 2015
@mhartington mhartington modified the milestones: 1.0.2, 1.2 Aug 15, 2015
@perrygovier
Copy link
Contributor

Fixed in 9c37863

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants