feat: update scrollspy and fix active links - #3708
Conversation
✅ Deploy Preview for boosted ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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. |
| _getSettleTarget() { | ||
| return this._rootElement || document | ||
| } |
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
louismaximepiton
left a comment
There was a problem hiding this comment.
I haven't reviewed the JS properly, but it seems to work quite nicely
The design could be dig asynchronously, but non-blocking indeed
For the dual mode I think in most cases it doesn't change anything, my only concern is about dropdowns (which should not have been used)
A typo I guess but I do not get it |
vprothais
left a comment
There was a problem hiding this comment.
Just thought that we should add an information about that in the migration from boosted documentation. There is a change, so maybe it is better to list it.


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