Skip to content

[FEATURE] Add scroll-to-top button #178

@ascender1729

Description

@ascender1729

Description

Add a floating button that appears when scrolled down to quickly return to the top of the page.

Why Needed

  • Long result lists require scrolling
  • Quick navigation back to search
  • Common UX pattern

Implementation Details

  • Show button after scrolling 300-500px
  • Fixed position bottom-right
  • Smooth scroll animation to top
  • Fade in/out transition

Files to Create/Modify

  • src/components/shared/ScrollToTop.svelte (new)
  • src/layouts/Layout.astro or main component

Code Example

<script>
  let showButton = false;
  
  function handleScroll() {
    showButton = window.scrollY > 400;
  }
  
  function scrollToTop() {
    window.scrollTo({ top: 0, behavior: 'smooth' });
  }
</script>

<svelte:window on:scroll={handleScroll} />

{#if showButton}
  <button onclick={scrollToTop} class="fixed bottom-4 right-4">
    <ArrowUpIcon />
  </button>
{/if}

Acceptance Criteria

  • Button appears when scrolled down
  • Smooth scroll animation to top
  • Fade in/out transition
  • Mobile-friendly size and position

Time Estimates

  • With AI: 135 minutes
  • Without AI: 900 minutes

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions