static-spa-interactions

Add persistent state, navigation, theming, and responsive UI to a vanilla SPA.

47|10|Updated May 14, 2026
One-click install
npx skills add https://github.com/kevintsai1202/teaching-site-skills --skill static-spa-interactions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: static-spa-interactions
Source: https://github.com/kevintsai1202/teaching-site-skills/tree/main/static-spa-interactions
Command: npx skills add https://github.com/kevintsai1202/teaching-site-skills --skill static-spa-interactions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This pattern adds a comprehensive interaction layer to a vanilla SPA: state persistence, navigation aids, theme toggling, responsive behavior, and accessible UI patterns that elevate a simple scaffold into a polished product.

Core Features & Use Cases

  • LocalStorage progress tracking (tasks and quizzes) with stable versioned keys
  • Sidebar behavior for desktop and mobile (toggle/overlay) and ScrollSpy highlighting
  • Theme toggle (dark/light) with persistent preference
  • Content zoom with isolated scope to avoid sidebar scaling
  • Keyboard accessible accordions and fade-in content
  • Copy-to-clipboard actions and lightweight toast notifications
  • Quiz with back-links to review sections and iframe modal viewers
  • Body scroll lock when modals are open to preserve focus
  • Lightweight modal viewer for embedded materials
  • All patterns are modular and can be added independently

Quick Start

Integrate the interaction layer into your vanilla SPA by wiring the patterns above to your UI and verifying behavior with the web-visual-verification skill.

Frequently Asked Questions about static-spa-interactions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add localStorage progress tracking to a vanilla SPA?

You can implement localStorage progress tracking in a vanilla SPA using stable versioned keys. This modular pattern persists task and quiz progress locally, maintaining user state across sessions without requiring external databases or complex backend integrations.

What is the best way to build a responsive sidebar with ScrollSpy in vanilla JavaScript?

Building a responsive sidebar with ScrollSpy in vanilla JavaScript requires a coordinated interaction layer handling toggle and overlay modes. This pattern automatically highlights navigation links based on scroll position, adapting seamlessly across desktop and mobile viewport sizes.

Can I implement a theme toggle with persistent preference in a single page application?

Yes, implementing a theme toggle with persistent preference in a single page application involves saving dark or light mode choices to localStorage. This pattern applies the selected theme consistently across user sessions without requiring external CSS frameworks or complex state management.

How do I prevent body scroll lock issues when opening modal viewers in a frontend application?

To prevent body scroll lock issues when opening modal viewers in a frontend application, apply an explicit body scroll lock pattern when modals open. This preserves user focus and disables background scrolling while interacting with embedded iframe materials or lightweight modal content.

Does this interaction layer require external dependencies to add content zoom and fade-in animations?

No, adding content zoom and fade-in animations does not require external dependencies. This interaction layer provides modular patterns with isolated scope to prevent sidebar scaling, allowing independent integration of accessible UI animations directly into a vanilla SPA scaffold.

When should I use a vanilla SPA interaction layer instead of a full frontend framework?

Use a vanilla SPA interaction layer instead of a full frontend framework when you need to polish a simple scaffold with state persistence, navigation aids, and accessible UI patterns. It elevates a basic product into a polished application without adding heavy framework overhead.