axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

Skip link placement: All page content should be contained by landmarks

Open tmc-ee opened this issue 1 year ago • 1 comments

Product

axe-core

Product Version

4.8.2

Latest Version

  • [X] I have tested the issue with the latest version of the product

Issue Description

Expectation

A skip link placed outside a landmark should not trigger a violation based on region rule, i.e. All page content should be contained by landmarks

It is best practice to contain all content excepting skip links, within distinct regions such as the header, nav, main, and footer.

Actual

If a skip link is not the first href defined on the page, a region violation is triggered due to the isSkipLink check.

How to Reproduce

  1. open up https://www.tax.service.gov.uk/help/terms-and-conditions
  2. you should see a cookie consent banner
  3. run axe with the banner open
  4. the skip link on the page won't be detected as a skip link and you will get a violation
  5. close the banner (i.e. click reject additional cookies, click hide cookies message)
  6. rerun axe
  7. the skip link is correctly detected and you will not get a violation

Additional context

The skip link is placed after the cookie banner as per GOV.UK design system guidance on Cookie Banner placement

Position the cookie banner after the opening

tag and before the ’skip to main content‘ link.

tmc-ee avatar Nov 09 '23 11:11 tmc-ee

Thanks for the issue. We'll look into ways we could address this.

straker avatar Nov 14 '23 22:11 straker