Skip to content

[doc] TOC highlighting improvements - #7089

Merged
adangel merged 1 commit into
pmd:mainfrom
zbynek:toc
Sep 24, 2026
Merged

adangel merged 1 commit into
pmd:mainfrom
zbynek:toc

Conversation

@zbynek

@zbynek zbynek commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Describe the PR

This addresses a few issues with the highlighting of active element on scroll:

  1. on small screens the TOC is at the top of the document, not fixed to screen. Scrolling TOC element into screen when related heading enters the screen makes the page constantly revert any scrolling done by the user. This PR disables auto-scroll with the smallscreen layout
  2. the TOC item that is highlighted is always the last heading that intersects the screen. That means that if you explicitly navigate to a rule with a short description, the next rule is highlighted: https://pmd.github.io/pmd/pmd_rules_java_documentation.html#danglingjavadoc . This PR keeps a list of headings that are fully on screen and highlights the first one

This PR also replaces >> with unicode to make the highlighting a bit visually nicer and removes some unused CSS.

Related issues

  • Fix #

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@zbynek
zbynek force-pushed the toc branch 2 times, most recently from 7dffda9 to fd47441 Compare September 19, 2026 07:24
@pmd-actions-helper

pmd-actions-helper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-09-19 13:45:32+00:00 for 271bbd3)

@adangel adangel added the in:documentation Affects the documentation [doc] label Sep 24, 2026
@adangel adangel added this to the 7.28.0 milestone Sep 24, 2026

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@adangel
adangel merged commit 1831734 into pmd:main Sep 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:documentation Affects the documentation [doc]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants