Skip to content

feat(client): add active slide CSS class - #2870

Open
code-jatin0112 wants to merge 1 commit into
slidevjs:mainfrom
code-jatin0112:feat/2835-active-slide-class
Open

code-jatin0112 wants to merge 1 commit into
slidevjs:mainfrom
code-jatin0112:feat/2835-active-slide-class

Conversation

@code-jatin0112

@code-jatin0112 code-jatin0112 commented Nov 25, 2026 •

Copy link
Copy Markdown

Closes #2835

Note

Maintainer confirmation on #2835 is still pending. This PR is submitted for review and feedback.

Summary

Adds a reactive slidev-page-active CSS class to the currently active slide inside #slideshow without changing existing slide visibility (v-show), layout, or transition behavior.

Implementation

  • packages/client/internals/SlidesShow.vue: Added :class="{ 'slidev-page-active': route === currentSlideRoute }" to <SlideWrapper> inside #slideshow.
    • Applied in SlidesShow.vue rather than SlideWrapper.vue so the active class tracks slideshow playback (currentSlideRoute) without leaking onto non-slideshow SlideWrapper instances such as overview thumbnails (/overview, QuickOverview), Presenter Next previews (including when sharing the same slide number across pending clicks), or standalone /print and /export frames.
  • cypress/e2e/examples/basic.spec.ts: Added two E2E regression tests verifying:
    • Play mode applies .slidev-page-active exclusively to the currently visible slide across forward/backward navigation and preserves it across v-click steps.
    • Presenter mode marks only the main slide active while keeping the Next preview unmarked.
  • docs/custom/directory-structure.md & docs/guide/animations.md: Documented .slidev-page-active under Targeting the Active Slide and cross-referenced it from the animations guide.

Verification

  • Cypress E2E suite (pnpm exec cypress run): 23/23 tests passing across all 5 specs (base-path, basic, iframe-layout, presenter-resizer, smoke), including the 2 new regression tests in cypress/e2e/examples/basic.spec.ts.
  • Targeted ESLint (pnpm exec eslint on the 4 changed files): passed (0 errors, 0 warnings).
  • Build (pnpm build): passed (5/5 tasks after the code and test edits; subsequent edit was docs-only).
  • Browser manual checks (Playwright Chromium against local dev server): Verified Play mode navigation, v-click, custom CSS .slidev-page-active styling, Overview, Presenter, /export, and /2?print=true with zero console errors.
  • Full-repo checks not clean due to pre-existing baseline issues (not caused by this PR):
    • pnpm verify halted at pnpm typecheck on a pre-existing type error in test/title-renderer-hmr.test.ts:77:67.
    • pnpm test --run (run after code/test changes): 388 passed, 1 pre-existing PlantUML snapshot mismatch in packages/slidev/node/syntax/integration.test.ts:110.
    • Repo-wide pnpm lint hits pre-existing errors in untouched files.

Checklist

  • Minimal, scoped change (4 files: client component, E2E test, and docs)
  • Regression tests added and passing in Cypress
  • Documentation updated
  • Assisted by AI tooling during investigation, testing, and drafting; changes and test outputs reviewed

@netlify

netlify Bot commented Nov 25, 2026

Copy link
Copy Markdown

👷 Deploy request for slidev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9efb4dd

@code-jatin0112
code-jatin0112 marked this pull request as ready for review November 25, 2026 11:30

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an slidev-page-active (or similar) class to the currently visible slide

1 participant