-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Open
Description
Enter your suggestions in details:
Summary
The MetaBar component renders a Table of Contents (TOC) using heading items,
but currently has no way to visually indicate which heading is active (i.e.,
currently visible in the viewport during scroll).
Proposed Changes
- Add an
activeSlugprop toMetaBar(or anisActiveprop on the link
component) so consumers can indicate which heading is currently active. - Add a CSS class (e.g.
.tocLink/.tocLinkActive) in
index.module.cssthat styles the active link usingbox-shadowinstead
ofborder-leftto avoid horizontal layout shift:
.tocLink {
box-shadow: inset 2px 0 0 transparent;
padding-left: 0.25rem;
}
.tocLinkActive {
box-shadow: inset 2px 0 0 var(--color-primary);
font-weight: 600;
color: var(--color-primary);
}Using box-shadow instead of border-left ensures the layout doesn't shift
when the active item changes during scrolling.
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
📋 Backlog