feat: update scrollspy and fix active links#3708
Open
MaxLardenois wants to merge 7 commits into
Open
Conversation
✅ Deploy Preview for boosted ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
MaxLardenois
marked this pull request as ready for review
July 22, 2026 19:45
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ScrollSpy implementation to an IntersectionObserver-driven approach (closer to Bootstrap v6), adjusts documentation behavior so pages without a Table of Contents don’t enable ScrollSpy, and tightens some site typing/export details.
Changes:
- Refactors
js/src/scrollspy.jsto use IntersectionObserver state for active section detection, addstopMarginoption, and adds smooth-scroll settle (hash + focus) behavior. - Marks many docs pages as
toc: falseso ScrollSpy isn’t enabled on pages without a TOC. - Exposes
DataTypefor typed sidebar loading and adjusts docs sidebar logic accordingly.
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| site/src/libs/icon.ts | Makes height/width optional for SVG icon props. |
| site/src/libs/data.ts | Exports DataType for typed getData() call sites. |
| site/src/layouts/DocsLayout.astro | Enables ScrollSpy only when toc is true; sets ScrollSpy top activation line via data-bs-top-margin. |
| site/src/content/docs/layout/form-layout.mdx | Sets toc: false to avoid enabling ScrollSpy without TOC. |
| site/src/content/docs/getting-started/webpack.mdx | Sets toc: false. |
| site/src/content/docs/getting-started/vite.mdx | Sets toc: false. |
| site/src/content/docs/getting-started/rtl.mdx | Sets toc: false. |
| site/src/content/docs/getting-started/parcel.mdx | Sets toc: false. |
| site/src/content/docs/getting-started/optimize.mdx | Sets toc: false. |
| site/src/content/docs/getting-started/component-versioning.mdx | Sets toc: false. |
| site/src/content/docs/foundation/images.mdx | Sets toc: false. |
| site/src/content/docs/components/tooltip.mdx | Sets toc: false. |
| site/src/content/docs/components/toast.mdx | Sets toc: false. |
| site/src/content/docs/components/title-bar.mdx | Sets toc: false. |
| site/src/content/docs/components/sticker.mdx | Sets toc: false. |
| site/src/content/docs/components/stepped-process.mdx | Sets toc: false. |
| site/src/content/docs/components/spinner.mdx | Sets toc: false. |
| site/src/content/docs/components/scrollspy.mdx | Sets toc: false. |
| site/src/content/docs/components/range.mdx | Sets toc: false. |
| site/src/content/docs/components/quantity-selector.mdx | Sets toc: false. |
| site/src/content/docs/components/progress.mdx | Sets toc: false. |
| site/src/content/docs/components/popover.mdx | Sets toc: false. |
| site/src/content/docs/components/pagination.mdx | Sets toc: false. |
| site/src/content/docs/components/offcanvas.mdx | Sets toc: false. |
| site/src/content/docs/components/navbar.mdx | Sets toc: false. |
| site/src/content/docs/components/nav-tab.mdx | Sets toc: false. |
| site/src/content/docs/components/modal.mdx | Sets toc: false. |
| site/src/content/docs/components/local-navigation.mdx | Sets toc: false. |
| site/src/content/docs/components/list-group.mdx | Sets toc: false. |
| site/src/content/docs/components/dropdown.mdx | Sets toc: false. |
| site/src/content/docs/components/collapse.mdx | Sets toc: false. |
| site/src/content/docs/components/close-button.mdx | Sets toc: false. |
| site/src/content/docs/components/carousel.mdx | Sets toc: false. |
| site/src/content/docs/components/card.mdx | Sets toc: false. |
| site/src/content/docs/components/back-to-top.mdx | Sets toc: false. |
| site/src/content/docs/components/accordion.mdx | Sets toc: false. |
| site/src/components/DocsSidebar.astro | Refactors sidebar selection and attempts to type sidebar data via Zod schema inference. |
| js/tests/unit/scrollspy.spec.js | Updates and expands unit tests for new ScrollSpy behavior and options. |
| js/src/scrollspy.js | Major ScrollSpy refactor: IO-based active detection, activation line config, sentinel bottom handling, smooth-scroll settle logic, and stricter target requirement. |
| js/src/dom/event-handler.js | Adds scrollend to the native event allowlist. |
| .bundlewatch.config.json | Updates bundle size thresholds to account for ScrollSpy code growth. |
Comment on lines
+436
to
+438
| _getSettleTarget() { | ||
| return this._rootElement || document | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
The smooth scroll should be investigated, maybe it's not useful in a OUDS context, also removing it would make the file smaller.
Will keep as is to be as close as possible to Bs6
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Types of change
Context & Motivation
Description
bodyChecklists
Checklist (for Core Team only)
Progression (for Core Team only)
mainfollowing conventional commitLive previews