guardian / guardian/dotcom-rendering

[Task]: How can we stop sticky nav overlapping H2s when anchored down

Open
#12,903 0 comments 1 reaction 0 assignees View on GitHub
maintenance Pick me up Rota Team Candidate: Articles and Publishing
Dominant language
TypeScript
Stars
274
Forks
34
Avg merge
2d 22h
Merged PRs (30d)
121

Description

### Context

A common problem with sticky navs that use hashed anchor links is the heading sits at the top of the viewport and is therefore covered by the navigation:
![Image](https://github.com/user-attachments/assets/07cdcbfe-8653-402b-ae38-31aa990b9a32)

—One option is to use a scrollTo function instead of the anchor links and offset the top value. This would mean a refactor of this component
—Another, using just css, is to apply a positive padding-top and negative margin-top. Like this https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header

Maybe there is another way...

cc @JamieB-gu @paperboyo

### Priority

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.