Skip to content

feat: add auto-hide header that responds to scroll direction#12

Merged
j4rviscmd merged 2 commits intomainfrom
feat/auto-hide-header
Mar 22, 2026
Merged

feat: add auto-hide header that responds to scroll direction#12
j4rviscmd merged 2 commits intomainfrom
feat/auto-hide-header

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Add useScrollDirection hook that tracks scroll direction via wheel events (not scroll) to avoid false positives from ProseMirror's scrollIntoView
  • Header collapses with max-height: 0 animation when scrolling down and reappears when scrolling up, reclaiming editor space (no visual gap)
  • Disable macOS rubber-band bounce at both app level (html, body { overflow: hidden }) and editor container level (overscroll-none)

Details

useScrollDirection hook (src/shared/hooks/useScrollDirection.ts)

  • Uses wheel events instead of scroll to ignore programmatic scrolling from BlockNote/ProseMirror
  • 200ms click lock prevents macOS synthetic wheel events on mousedown from toggling the header
  • Dead zone threshold (10px) prevents jittery toggling from small scroll movements
  • Always shows header when scrollTop === 0

Layout changes (src/App.tsx)

  • Header collapses via max-height transition (not transform) so the editor reclaims the space
  • Scroll container gets overscroll-none to prevent bounce at content edges

Global styles (src/index.css)

  • html, body { overflow: hidden } prevents app-level rubber-band bounce on macOS

Test plan

  • Scroll down in the editor — header should hide smoothly
  • Scroll up — header should reappear
  • Click anywhere in the editor — header should NOT toggle (click lock)
  • Move cursor with keyboard — header should NOT toggle (no wheel event)
  • Scroll to top — header should always be visible
  • Scroll to bottom — no bounce, no header flicker
  • Toggle sidebar — layout should remain correct

🤖 Generated with Claude Code

j4rviscmd and others added 2 commits March 22, 2026 20:59
Hide the header when scrolling down and reveal it when scrolling up.
Uses a custom `useScrollDirection` hook that listens to `wheel` events
to avoid false positives from programmatic scrolling (e.g. ProseMirror
scrollIntoView). A mousedown lock prevents click-triggered wheel events
from toggling the header. CSS `overscroll-none` disables rubber-band
bouncing in the scroll container, and `overflow: hidden` on html/body
prevents app-level bounce.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the enhancement New feature or request label Mar 22, 2026
@j4rviscmd j4rviscmd merged commit bf5642e into main Mar 22, 2026
@j4rviscmd j4rviscmd deleted the feat/auto-hide-header branch March 22, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant