Skip to content
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

feat(uiSrefActive): allow active & active-eq on same element #1999

Closed
wants to merge 2 commits into from
Closed

feat(uiSrefActive): allow active & active-eq on same element #1999

wants to merge 2 commits into from

Conversation

joshuahiggins
Copy link
Contributor

This pull request will allow the usage of both ui-sref-active and ui-sref-active-eq on the same element.

One use case includes menus with expanding states where a parent element can be both active and open, such as in this example:

<ul>
  <li ui-sref-active="open" ui-sref-active-eq="active">
    <a ui-sref="home"></a>
    <ul>
      <li ui-sref-active-eq="active">
        <a ui-sref="home.view1"></a>
      </li>
      <li ui-sref-active-eq="active">
        <a ui-sref="home.view2"></a>
      </li>
    </ul>
  </li>
  <li ui-sref-active="open" ui-sref-active-eq="active">
    <a ui-sref="account"></a>
    <ul>
      <li ui-sref-active-eq="active">
        <a ui-sref="account.view1"></a>
      </li>
      <li ui-sref-active-eq="active">
        <a ui-sref="account.view2"></a>
      </li>
      <li ui-sref-active-eq="active">
        <a ui-sref="account.view3"></a>
      </li>
    </ul>
  </li>
</ul>

When the account child views are active, the parent view should have a class of "open". However, when the parent is active, then the parent element should have both "open" and "active" classes.

This pull request exposes a race condition bug which I have created a separate issue for, #1997. Due to the slight decrease in performance by adding this functionality, the bug is now evident through the failure of one unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant