json-schema-org / json-schema-org/website

🐛 Bug: Heading anchor highlight (:target) cannot be cleared without navigating to another heading

Open
#2,214 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug
  • Across multiple docs pages on JSON Schema, clicking a heading applies a persistent highlight due to CSS :target styling.

  • After clicking a heading (e.g. “Benefits of being a silver sponsor”), the highlight cannot be removed by:

    • Clicking the same heading again
    • Clicking anywhere else on the page
    • Scrolling
  • The only way to remove the highlight is to click another heading (changing the URL hash).

  • This creates a “stuck highlighted” state and degrades the reading experience.

Steps To Reproduce
  1. Open the page above
  2. Click on the heading “Benefits of being a silver sponsor”
  3. Notice the heading becomes highlighted
  4. Try to remove the highlight by clicking elsewhere → it remains
  5. Click a different heading → previous highlight disappears
Expected Behavior

The highlight applied by :target should be cleared when:

  • Clicking anywhere outside headings, or
  • Clicking the same heading again

This is the behavior followed by most documentation sites (e.g. MDN, GitHub Docs).

Screenshots

https://github.com/user-attachments/assets/3ab23b94-c838-499a-92b9-c1678bb2a858

Device Information [optional]
- OS:Ubuntu (Latest)
- Browser:Brave
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue on the affected JSON Schema documentation page, using the “Benefits of being a silver sponsor” heading, then inspect the heading-anchor behavior and CSS :target styling. Done means the highlight is removed when clicking outside headings or clicking the same heading again, while changing to another heading still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html
Domain
documentation, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.