frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Skip link not working on About pages

Open MartinJJones opened this issue 1 year ago • 3 comments

What

The skip link does not allow you to skip to the main content on the /help pages, with the exception of /help/cookies

The JavaScript error below is thrown in the console:

Error starting GovukSkipLink component JS
ElementError: govuk-skip-link
Target content (`id="content"`) not found

Possible fix

We should be able to fix this by adding <main id="content"> to the _body_with_related_links.html.erb view template, similar to the approach used in _base_page.html.erb

MartinJJones avatar Nov 18 '24 14:11 MartinJJones

Good spot @MartinJJones. I think this might relate to some of recent app consolidation work, going to ping @KludgeKML to check.

andysellick avatar Nov 18 '24 14:11 andysellick

Yes, that's correct - when the help pages got moved over (they were the first set to be moved), we didn't notice that government-frontend pages all had an implicit main element in the layout, but frontend pages all supplied their own main element. I'll write up a card to get this added.

KludgeKML avatar Nov 18 '24 14:11 KludgeKML

Thanks @andysellick @KludgeKML 👍

MartinJJones avatar Nov 18 '24 14:11 MartinJJones

Closing this issue, as it appears to be resolved. I've checked several help pages (excluding /help/cookies), and they all have id="content" on the main element. The skip links correctly navigate to the first interactive element within the main container as well.

jon-kirwan avatar Sep 09 '25 13:09 jon-kirwan