retro: 가상 스크롤 회고 — 동적 높이 지원·테스트·접근성#150
Open
chaeheonjeong wants to merge 3 commits into
Open
Conversation
- SearchTotal에 인라인으로 있던 가상 스크롤 로직을 재사용 가능한 훅으로 추출 - 고정 ITEM_HEIGHT 가정을 제거: ResizeObserver로 아이템 높이를 실측해 캐시하고, 미측정 아이템은 추정치로 계산 - 누적 높이(prefix sum) 배열 + 이진 탐색으로 시작 인덱스 계산 - 컨테이너 상단 여백(margin-top)을 스크롤 위치 계산에 보정
- buildOffsets / findStartIndex / getVisibleRange 경계값 포함 9케이스 - 테스트가 로드 단계에서 실패하던 문제 수정: vite.config.js가 참조하는 setupTests.js가 .gitignore에 등록되어 저장소에 존재하지 않았음 → ignore 항목을 제거하고 설정 파일 추가
- 가상 스크롤은 화면 밖 아이템을 DOM에서 제거하므로 보조기술이 리스트의 전체 규모와 현재 위치를 알 수 없는 문제가 있음 - 리스트 컨테이너에 role=feed, 아이템에 role=article과 aria-posinset / aria-setsize를 부여해 전체 중 몇 번째인지 노출
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 사항
1.
useVirtualWindow훅 추출 + 동적 높이 지원SearchTotal에 인라인으로 있던 가상 스크롤 로직을 훅으로 분리ITEM_HEIGHT가정 제거 — ResizeObserver로 실측한 높이를 캐시하고, 누적 높이 배열 + 이진 탐색으로 시작 인덱스를 계산합니다2. 오프셋 계산 로직 단위 테스트 (9케이스, 통과 확인)
virtualWindow.utils.js)로 분리해 DOM 없이 테스트setupTests.js가 .gitignore에 등록되어 있어 테스트가 로드조차 안 되던 문제도 함께 수정3. 접근성 속성
role=feed/role=article/aria-posinset/aria-setsize부여검증
npm test— 9/9 통과