Skip to content

[fix] Storybook에서 열린 채 시작하는 오버레이와 모바일 뷰포트 스토리가 빈 화면으로 그려지는 문제를 고친다 - #2278

Merged
seongwon030 merged 2 commits into
develop-fefrom
fix/#2277-storybook-overlay-viewport-render-MOA-1239
Nov 1, 2026
Merged

seongwon030 merged 2 commits into
develop-fefrom
fix/#2277-storybook-overlay-viewport-render-MOA-1239

Conversation

@seongwon030

@seongwon030 seongwon030 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Close #2277

머지하면 Chromatic에서 오버레이 스토리 12개가 변경으로 잡힌다. 지금까지 빈 화면(또는 버튼만)으로 찍혀 있던 것이 실제 오버레이로 바뀌는 것이라 승인하면 된다.

문제

열린 채 시작하는 오버레이 스토리가 첫 렌더에서 비어 있었다. #modal-root를 preview 데코레이터의 useEffect에서 만들었는데, 자식 컴포넌트가 먼저 렌더되면서 Portal이 getElementById에서 null을 받아 아무것도 그리지 않았다. useBodyScrollLock만 실행돼서 body는 잠긴 채로 남았다. 처음부터 열려 있으니 다시 렌더할 계기도 없어서, Chromatic baseline도 이 빈 상태로 찍혀 있었다.

모바일 뷰포트 스토리가 데스크톱 폭으로 열렸다. Storybook 10은 parameters.viewport.defaultViewport를 읽지 않는다. 그래서 모바일 전용인 Popup은 Storybook 화면에서 열리지 않았다.

해결

  • .storybook/preview-body.html에 <div id="modal-root">를 둬서 앱 index.html과 같게 첫 렌더 전부터 존재하게 한다. effect의 생성 코드는 지웠다
  • Popup·UnderlineTabs/CenterOnMobile에 globals.viewport(iphone6)를 더한다. Chromatic 문서상 스냅샷 폭은 defaultViewport를 따르므로 그 설정은 남겼다

검증

수정 전(develop-fe)과 수정 후 정적 빌드를 Playwright로 비교했다.

확인 수정 전 수정 후
오버레이 스토리 첫 렌더 #modal-root 자식 수 0 1
Popup 매니저 iframe 폭 1100px (팝업 안 뜸) 375px (팝업 뜸)
202개 스토리 전체 픽셀 비교에서 바뀐 스토리 — 오버레이 12개 + ResultCard 5개

ResultCard 5개는 수정 전 빌드끼리 비교해도 231~302px 차이가 나는, 원래 흔들리는 스토리다. 이번 변경과는 무관하다. 바뀐 오버레이 스토리에는 autodocs 페이지가 없어서, 오버레이가 docs 페이지를 덮는 문제는 생기지 않는다. 타입체크와 build-storybook은 통과했다.

영향 범위

Storybook과 Chromatic baseline만 바뀐다. 앱 번들에는 닿지 않는다. Chromatic이 globals.viewport도 읽는지는 확인하지 못했다. 그래서 defaultViewport를 그대로 두었고, 이 두 스토리의 Chromatic 폭은 바뀌지 않을 것으로 본다.

Summary by CodeRabbit

  • 개선 사항
    • Storybook에서 팝업과 오버레이가 안정적으로 표시됩니다.
    • 모바일 화면을 기준으로 탭과 팝업을 미리 볼 수 있습니다.
  • 문서
    • 오버레이 관련 안내에서 Storybook 설정 위치가 최신 내용으로 반영되었습니다.

- 데코레이터 useEffect에서 #modal-root를 만들면 자식 렌더가 먼저 돌아 Portal이 null을 반환하고 body 잠금만 남았다
- 앱 index.html처럼 preview-body.html에 #modal-root를 두고 effect의 생성 코드를 지운다
- Storybook 10은 defaultViewport를 읽지 않아 Popup·UnderlineTabs 모바일 스토리가 데스크톱 폭으로 열렸다
- Chromatic 스냅샷 폭에 쓰이는 defaultViewport는 두고 globals.viewport를 더한다
@seongwon030 seongwon030 self-assigned this Oct 29, 2026
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
moadong Ready Ready Preview Oct 29, 2026 11:45am UTC

@github-actions github-actions Bot added the 💻 FE Frontend label Oct 29, 2026
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 6cf24af and b77e99d.

Files selected for processing: 5
  • frontend/.storybook/preview-body.html
  • frontend/.storybook/preview.tsx
  • frontend/src/components/CLAUDE.md
  • frontend/src/components/common/UnderlineTabs/UnderlineTabs.stories.tsx
  • frontend/src/pages/MainPage/components/Popup/Popup.stories.tsx
Files with no reviewable changes: 1
  • frontend/.storybook/preview.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Storybook 미리보기 HTML에 modal-root를 추가하고 decorator의 동적 생성 처리를 제거했습니다. UnderlineTabs와 Popup 스토리에 globals.viewport 설정을 추가했습니다.

Changes

Storybook 렌더링 수정

Layer / File(s) Summary
모달 Portal 대상 요소 제공
frontend/.storybook/preview-body.html, frontend/.storybook/preview.tsx, frontend/src/components/CLAUDE.md
미리보기 HTML에 modal-root 요소를 추가했습니다. decorator에서 해당 요소를 생성하던 처리를 제거하고 문서의 생성 위치 설명을 갱신했습니다.
모바일 스토리 뷰포트 설정
frontend/src/components/common/UnderlineTabs/UnderlineTabs.stories.tsx, frontend/src/pages/MainPage/components/Popup/Popup.stories.tsx
두 스토리에 iphone6와 회전 상태 false를 지정하는 globals.viewport 설정을 추가했습니다. 기존 parameters.viewport.defaultViewport 설정은 유지했습니다.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: 💻 FE, 🛠Fix

Merge Risk: Minimal · up to b77e9

The Storybook-only changes have no established merge-blocking defect and are mergeable with normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 제목은 Storybook에서 초기 오버레이가 비어 보이고 모바일 뷰포트 스토리가 빈 화면으로 렌더링되는 문제를 명확히 설명합니다. PR의 주요 변경 사항과 일치합니다.
Linked Issues check Passed 직접 연결된 활성 이슈 [#2277]의 두 코딩 요구사항을 PR 변경 요약이 충족한다. frontend/.storybook/preview-body.html에 #modal-root를 추가하고 frontend/.storybook/preview.tsx의 지연 생성 코드를 제거했다. 따라서 오버레이 Portal이 첫 렌더 전에 대상 요소를 사용할 수 있…
Out of Scope Changes check Passed 변경된 파일은 Storybook의 preview-body.html, preview.tsx, 관련 컴포넌트 문서, UnderlineTabs 스토리, Popup 스토리다. CLAUDE.md의 Portal 위치 문서 수정은 [#2277] 구현 위치와 일치한다. 테스트 대상 스토리의 메타데이터 수정은 모바일 뷰포트 요구사항을 구현한다. 제공된 변…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

직접 연결된 활성 이슈 [#2277]의 두 코딩 요구사항을 PR 변경 요약이 충족한다. frontend/.storybook/preview-body.html에 #modal-root를 추가하고 frontend/.storybook/preview.tsx의 지연 생성 코드를 제거했다. 따라서 오버레이 Portal이 첫 렌더 전에 대상 요소를 사용할 수 있다. UnderlineTabs/UnderlineTabs.stories.tsx와 Popup/Popup.stories.tsx에 globals.viewport를 추가했다. 기존 defaultViewport도 유지했다. 변경 범위는 Storybook 설정과 스토리 메타데이터에 한정된다.

Full details: Out of Scope Changes check

Explanation

변경된 파일은 Storybook의 preview-body.html, preview.tsx, 관련 컴포넌트 문서, UnderlineTabs 스토리, Popup 스토리다. CLAUDE.md의 Portal 위치 문서 수정은 [#2277] 구현 위치와 일치한다. 테스트 대상 스토리의 메타데이터 수정은 모바일 뷰포트 요구사항을 구현한다. 제공된 변경 요약에는 이슈와 무관한 앱 기능 변경이 없다.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (2 skipped: 2 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@diboreview-e2e-bot diboreview-e2e-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

켜진 규칙 위반이 없어요.

지적 0개 · 버린 지적 0개 · 중복 제외 0개 · 비용 $0.0172

@reviewer-harry

reviewer-harry Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Claude finished @seongwon030's task in 19s —— View job


harry 리뷰 총평

리뷰 기준을 위반한 곳은 없어요. 따로 남긴 인라인 코멘트도 없어요.

이번 PR은 #modal-root를 데코레이터의 useEffect에서 만들던 방식을 바꿔, preview-body.html에 처음부터 두게 했어요. 첫 렌더 순서 문제를 뿌리에서 끊었고, 앱 index.html과 같은 구조를 맞춘 점이 깔끔해요. 쓸모없어진 useEffect 코드도 지웠고 components/CLAUDE.md의 설명도 함께 고쳤어요. 새로 단 주석 두 종류는 왜 이렇게 했는지를 적고 있어서 남겨 둘 만한 주석이에요. Portal 대상을 미리 두는 이유, defaultViewport와 globals.viewport를 함께 쓰는 이유가 여기에 해당해요. 👍

@diboreview-e2e-bot

Copy link
Copy Markdown

이 PR의 규칙 관련 변경을 분석해 규칙 후보 1개를 찾았어요. 켜기 전에는 리뷰에 쓰지 않아요.

  • repo/toast-no-action-use-snackbar

대시보드에서 근거를 보고 켜요: http://127.0.0.1:3000/repos/Moadong/moadong

@github-actions

Copy link
Copy Markdown

🎨 UI 변경사항을 확인해주세요

변경된 스토리를 Chromatic에서 확인해주세요.

구분 링크
🔍 변경사항 리뷰 https://www.chromatic.com/build?appId=67904e61c16daa99a63b44a7&number=1280
📖 Storybook https://67904e61c16daa99a63b44a7-ccpnxvbqco.chromatic.com/

202개 스토리 변경 · 전체 202개 스토리 · 70개 컴포넌트

@seongwon030
seongwon030 merged commit 462380b into develop-fe Nov 1, 2026
14 checks passed
@seongwon030
seongwon030 deleted the fix/#2277-storybook-overlay-viewport-render-MOA-1239 branch November 1, 2026 14:15

This branch was successfully deployed

1 active deployment
Preview — b77e99db Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant