Skip to content

fix(ui): sidebar hover bar alignment, dashed links, TOC scroll-spy activation - #307

Merged
vshengbro merged 2 commits into
masterfrom
fix/sidebar-hover-bar-link-dashed
Oct 10, 2026
Merged

vshengbro merged 2 commits into
masterfrom
fix/sidebar-hover-bar-link-dashed

Conversation

@vshengbro

Copy link
Copy Markdown
Collaborator

Summary

Three fixes to the docs shell, all verified against a local docs build at 1440x900.

Sidebar group-title hover bar — the ::before indicator used a different offset
for group titles (-2px) than for leaf links (-8px), so a hovered group title showed
its bar floating 7px away from the dashed tree guide while a leaf link sat 1px away.
Both are now -9px, which puts the bar's left edge exactly on the guide at every
nesting depth: the bar covers the guide, matching the reference look and the
active-fill edge, which already starts at the guide. Measured bar-left == guide-left
at depth 1 and 2 for both row kinds.

Markdown link underline — back to dashed (it was flattened to solid when the
hover variant was removed). Still one static rule, no :hover restyle.

TOC scroll spy — the active-entry highlighter never worked: it compared the
percent-encoded location.hash fragment against raw UTF-8 href fragments, so nothing
ever matched, and it only listened to hashchange, so scrolling never activated
anything. Rewritten to percent-decode before comparing, track the section at the
top of the scroll container on scroll, fall back to the first entry on plain load
and the last entry at the bottom, and mutate class lists only when the active entry
actually changes (the old version could re-trigger its own MutationObserver). The
pre-existing CSS then renders the active entry at font-weight 700; hover on
inactive entries stays 400.

Verification

  • Plain load: first TOC entry active at 700
  • Scroll: active follows the current section; bottom of page activates the last entry
  • Click: percent-decoded hash match activates the clicked entry
  • Hover on a non-active TOC entry: stays 400
  • Sidebar: bar-left == guide-left at depth 1 and 2; active fill still lands exactly
    on the guide; row height 48px in all states
  • cargo fmt --check clean, clippy 0 warnings, full test suite passing

Version 0.28.21, workspace pins realigned.

The docs shell paints the hover indicator as a `::before` bar, and the two
row kinds sat at different offsets from the dashed tree guide: leaf links at
`left: -8px`, group titles at `left: -2px`. A group title therefore hovered
with its bar floating 7px away from its guide while a leaf link sat 1px away,
so the two kinds did not read as the same control. Both are now `-8px`, which
puts each bar 1px from the guide that row actually hangs off.

Also switch the markdown link underline back to dashed. It was solid after
the previous pass removed the hover variant, which flattened the distinction
between a link and surrounding body text. Still one static rule for both
states — no `:hover` restyle.

Verified against a local docs build at 1440x900: group titles and leaf links
both report a 1px gap to their guide at every nesting depth, the underline
computes as dashed, and no `.md-body a:hover` rule exists.
…the sidebar guide with the hover bar

TOC scroll spy (docs): the old hash matcher compared the percent-encoded
location.hash fragment against raw UTF-8 href fragments, so no entry ever
matched and nothing was ever marked active. It also only reacted to
hashchange, so scrolling never updated the active entry. Rewritten to:
decode the fragment before comparing, track the section at the top of the
scroll container on scroll events, fall back to the first entry on plain
load and to the last entry when scrolled to the bottom, and only touch
class lists when the active entry actually changes so the MutationObserver
cannot re-trigger itself. The existing rules then render the active entry
bold at 700 while hover stays at 400.

Sidebar hover bar (docs): the ::before indicator sat 1px to the right of
the dashed tree guide (-8px), leaving the guide visible as a separate
stroke next to the bar. Moved to -9px so the bar starts exactly at the
guide and covers it, matching the active-fill edge which already starts
at the guide. Verified bar-left == guide-left at both nesting depths.
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Oct 10, 2026
@vshengbro
vshengbro merged commit f663dd7 into master Oct 10, 2026
8 checks passed
@vshengbro
vshengbro deleted the fix/sidebar-hover-bar-link-dashed branch October 10, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant