User Story: As a user, I need the rendered JSON or Markdown to stay in sync when I scroll on the raw data side (the left side).
- Added
initScrollSync()function with:- Percentage-based scroll calculation (handles different content heights)
- Throttled scroll events (~60fps / 16ms) for smooth performance
- Toggle button creation for preview panel headers
- localStorage persistence of user preference
- Prevention of feedback loops with
isScrollingflag
- Added
.scroll-sync-togglebutton styles- Matches existing toolbar button aesthetic
- Active state uses accent color
- Hidden on mobile (stacked layout doesn't need sync)
- Sync Method: Percentage-based (
scrollTop / (scrollHeight - clientHeight)) - Performance: Throttled to ~60fps using timestamp comparison
- Scope: Left-to-right sync only (raw input → rendered preview)
- Persistence: User preference saved in localStorage as
scrollSyncEnabled
| File | Lines Added |
|---|---|
src/js/newtab.js |
+123 |
src/css/newtab.css |
+52 |
- All 51 existing tests pass
- Manual testing: scroll sync works for both JSON and Markdown tabs
- None for this feature
(No prior sessions recorded)