You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SkipLink double jumps to first heading then #maincontent if disableDefaultBehaviour is not set #166
Currently if the SkipLink is included without any additional attributes, and there is an element on the page with an id of maincontent, then clicking the skip to content link causes a double jump, first to the heading, then to #maincontent.
A suggested fix would be to always call e.preventDefault, then jump to either the first heading or #maincontent based on the setting of disableDefaultBehaviour and the existence of the id, e.g.
Activity
KaiSpencer commentedon May 8, 2023
Interesting discussion I will link in around the original motivation on the focus of h1.
nhsuk/nhsuk-frontend#864 (comment)
colinrotherham commentedon Sep 9, 2025
This is fixed in #267
Behaviour now matches NHS.UK frontend with only the jump to
#maincontent