Skip to content

[Bug]: Lenis smooth-scroll script loaded on every page but never initialized - LENIS_PR_FIXES.md documents code absent from script.js #1833

Description

@ionfwsrijan

Summary

The Lenis smooth-scroll library (https://unpkg.com/lenis@1.1.13/dist/lenis.min.js) is loaded on seven templates, but no code ever initializes it — there are zero references to Lenis/lenis anywhere in the JavaScript. Smooth scrolling never activates on any page. The repository's own LENIS_PR_FIXES.md documents initialization code that does not exist in script.js.

Evidence

  • <script src="https://unpkg.com/lenis@1.1.13/dist/lenis.min.js"> is included in:
    • src/templates/index.html:1403
    • src/templates/explore.html:734
    • src/templates/project.html:429
    • src/templates/404.html:36
    • src/templates/405.html:34
    • src/templates/500.html:34
  • A search for lenis/Lenis across src/ returns matches only for those template <script> tags. src/static/script.js contains no Lenis initialization, no typeof Lenis === 'undefined' fallback, and no prefers-reduced-motion handling.
  • LENIS_PR_FIXES.md (in the repo root) claims:

    "Centralized all initialization logic in /static/script.js" and shows code if (typeof Lenis === 'undefined') { console.warn(...); return; } at "DevPath/static/script.js - Lines 25-71".
    None of that code exists in the actual script.js (lines 25-71 are theme-modal code).

  • Additionally, the CSP header in src/app.py:130-132 is script-src 'self' 'unsafe-inline' — it does not include https://unpkg.com, so the CDN script is blocked by the browser on every page regardless.

Impact

  • The documented smooth-scrolling feature is inert on all pages; loading an external script on every page (including error pages) for a feature that never runs is pure overhead and a supply-chain surface.
  • Developers following LENIS_PR_FIXES.md will expect behavior that does not exist.

Suggested Fix

Either (a) implement the centralized initialization described in LENIS_PR_FIXES.md (including the prefers-reduced-motion check, typeof Lenis guard, and destroy-on-preference-change), plus add https://unpkg.com to script-src, or (b) remove the unused <script> tags from all seven templates and delete/update LENIS_PR_FIXES.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions