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

Incorrect padding-left applied to anchors in usa-sidenav__sublist #3944

Closed
JonMcL opened this issue Jan 15, 2021 · 0 comments · Fixed by #3951
Closed

Incorrect padding-left applied to anchors in usa-sidenav__sublist #3944

JonMcL opened this issue Jan 15, 2021 · 0 comments · Fixed by #3951
Labels
Type: Bug A problem in the code

Comments

@JonMcL
Copy link

JonMcL commented Jan 15, 2021

When using a standard anchor tag, incorrect padding-left is applied for sublists that use the nav-sublist mixin.

It looks like this issue was introduced in #3838. Order of precedence causes the padding specified by a:not(.usa-button), inside the nav-list mixin, to replace the padding-left specified by the nav-sublist mixin.

Steps to reproduce the bug

  1. Create a sidebar with one or more sublists like:
<nav aria-label="Secondary navigation">
    <ul class="usa-sidenav">
        <li class="usa-sidenav__item">
            <a href="">Parent link</a>
        </li><li class="usa-sidenav__item">
        <a href="" class="usa-current">Current page</a><ul class="usa-sidenav__sublist">
        <li class="usa-sidenav__item">
            <a href="">Child link</a>
        </li><li class="usa-sidenav__item">
        <a href="">Child link</a>
    </li><li class="usa-sidenav__item">
        <a href="">Child link</a>
    </li><li class="usa-sidenav__item">
        <a href="">Child link</a>
    </li><li class="usa-sidenav__item">
        <a href="" class="usa-current">Child link</a>
    </li>
    </ul>
    </li><li class="usa-sidenav__item">
        <a href="">Parent link</a>
    </li>
    </ul>
</nav>
  1. Inspect the padding-left for any of the .usa-sidenav__sublist a anchor tags. (i.e. the anchor tag for the first "Child link")
  2. You will see that padding from .usa-sidenav a:not(.usa-button) is replacing the padding-left from .usa-sidenav__sublist a

Expected behavior

The first "Child link" anchor tag should have padding-left value that indents it to the right. (i.e. padding-left: 2rem)

You can see the issue on https://designsystem.digital.gov/components/sidenav/

Screenshots

Expected results:
image

Results after #3838:
image

System setup

  • USWDS version: 2.10.0
  • Browser and version: Chrome 87.0

Possible solution

In the nav-sublist mixin, change the a { ... } selectors, for the multiple levels, to be a:not(.usa-button) { ... }

@JonMcL JonMcL added the Type: Bug A problem in the code label Jan 15, 2021
fsierra added a commit to mobomo/uswds that referenced this issue Jan 20, 2021
@mejiaj mejiaj added this to On-deck in USWDS Sprint Board Jan 21, 2021
@mejiaj mejiaj moved this from On-deck to Done in USWDS Sprint Board Jan 27, 2021
mejiaj pushed a commit that referenced this issue Feb 3, 2021
This was referenced Feb 19, 2021
@thisisdano thisisdano added this to Bugs and ongoing work in USWDS Roadmap Backlog Feb 23, 2021
@thisisdano thisisdano removed this from Bugs and ongoing work in USWDS Roadmap Backlog Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug A problem in the code
Projects
2 participants