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

False Positive: Angular skiplink using routerLink & fragment #1204

Closed
MrGrigri opened this issue Oct 25, 2018 · 12 comments
Closed

False Positive: Angular skiplink using routerLink & fragment #1204

MrGrigri opened this issue Oct 25, 2018 · 12 comments
Assignees
Labels
best practice fix Bug fixes rules Issue or false result from an axe-core rule

Comments

@MrGrigri
Copy link

When utilizing the Angular router module as a skip-link, the Axe browser extension for Chrome creates a false positive claiming: "All page content must be contained by landmarks". I believe this might be an issue due to the fact that there is no href attribute on the link itself. There are a couple of Angular directives (routerLink and fragment) as well as a click event binding that controls what happens when the user clicks or interacts with the link.


axe extension version: 3.5.2
axe extension on: Chrome (69)

Browser and Assistive Technology versions

For Tooling issues:
- Node version: 8.11.1
- Platform:  Windows (10/1709)
@marcysutton
Copy link
Contributor

@MrGrigri the example won't load for me, can you check to make sure your demo works without authenticating on stackblitz?

@MrGrigri
Copy link
Author

Yeah, I opened it in an 'incognito' window in chrome and it works fine.

@marcysutton
Copy link
Contributor

Hmm, still won't load for me.
network request failed

@MrGrigri
Copy link
Author

My guess is your local network is blocking it.

@marcysutton
Copy link
Contributor

It was something weird with Chrome–I can get it to load in Firefox.

The link does render an href, but I think it's being thrown off by the clientside routing. If you remove the / from /#main-content in the skip link href, it passes. Sounds related to the fix that was added in #824, except this is the other way around (routing for skip links, which was excluded). Any thoughts on this @WilcoFiers? Seems like we can't really have it both ways...?

@MrGrigri
Copy link
Author

Yeah, Angular adds the href attribute...there's no way of changing that (as far as I know)

@marcysutton
Copy link
Contributor

It wouldn't be a focusable skip link without the href, so that part seems necessary.

@WilcoFiers
Copy link
Contributor

Any update on this? Can you maybe provide a codepen that we could use instead @MrGrigri?

@jeeyyy
Copy link
Contributor

jeeyyy commented Nov 2, 2018

I was able to get the example running.

Based on inspecting the DOM, it is clear that the skip link perhaps needs a landmark region (just as axe reports).

image

image

@MrGrigri
Could you try surrounding the a with nav or specifying a role=navigation on the parent div of the anchor?

@MrGrigri
Copy link
Author

MrGrigri commented Nov 2, 2018

That div is only there to push the rest of the content down - ONLY FOR THE DEMO. That a element is the top-level element. Even when it's outside of that div, the error is still present. This demo is also being used for something else.

Here is the link to the code. It's all in angular.

@WilcoFiers
Copy link
Contributor

After some research, I think I've figured it out. What's happening is that the skip to content link is has a / at the beginning of the href: /#main-content instead of #main-content. Axe isn't expecting you to use the / first.

This is a false positive, clearly this is a skiplink and axe is misidentifying it. We'll have to fix it. Thank you for reporting!

@WilcoFiers WilcoFiers added fix Bug fixes rules Issue or false result from an axe-core rule best practice labels Nov 19, 2018
@MrGrigri
Copy link
Author

Thanks for y'all's help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
best practice fix Bug fixes rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

4 participants