Skip to content

fix: 섹션 높이가 뷰포트보다 큰 경우 활성 섹션 감지 부정확 #40

Description

@bae080311

문제

섹션 높이가 뷰포트보다 훨씬 클 경우, IntersectionObserverintersectionRatio가 항상 낮은 값으로 유지됩니다.
현재 로직은 intersectionRatio를 단순 비교해 활성 섹션을 결정하기 때문에, 큰 섹션이 화면 대부분을 차지하고 있어도 다른 섹션이 활성으로 잘못 감지될 수 있습니다.

// ScrollManager.ts
const best = visibleEntries.reduce((prev, current) =>
  prev.intersectionRatio > current.intersectionRatio ? prev : current,
);

rootMargin 커스터마이징 옵션이 추가되어 어느 정도 우회 가능하지만, 근본적인 해결은 아닙니다.

기대 동작

  • 섹션이 뷰포트보다 클 때는 intersectionRatio 대신 뷰포트 내 노출 픽셀 또는 교차 영역 비율(섹션 기준)로 활성 판단
  • 또는 IntersectionObserver + scroll 이벤트 병행으로 큰 섹션 진입 여부를 별도 추적

재현 조건

  • 뷰포트 높이: 800px
  • 섹션 높이: 3000px 이상
  • 해당 섹션이 화면 대부분을 채우고 있어도 인접한 짧은 섹션이 활성으로 감지됨

영향 범위

packages/core/src/ScrollManager.tshandleIntersection 메서드

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions