-
Notifications
You must be signed in to change notification settings - Fork 0
Fix#373 배너 닫기 클릭시 신청하기 페이지로 이동하는 현상 수정 #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe close button click handler in mosu-app/src/features/banner/ui/Banner.tsx now calls e.preventDefault() before e.stopPropagation() and hideBanner(), preventing Link navigation when the close icon is clicked while still stopping propagation and hiding the banner. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CloseButton as Close Button (X)
participant LinkWrapper as Link Wrapper
participant Banner as Banner State
User->>CloseButton: Click X
activate CloseButton
CloseButton->>CloseButton: e.preventDefault()
Note right of CloseButton: Prevent default Link navigation
CloseButton->>CloseButton: e.stopPropagation()
Note right of CloseButton: Stop event bubbling to Link
CloseButton->>Banner: hideBanner()
deactivate CloseButton
Banner-->>User: Banner hidden (no navigation)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(No out-of-scope changes identified.) Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
📝 추가 및 변경된 파일총 1개 파일 변경 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
mosu-app/src/features/banner/ui/Banner.tsx (2)
19-26: Avoid nested interactive elements: move the close button outside the Link for valid HTML and better a11yA button inside an anchor is invalid and can still cause edge-case navigations and focus quirks. Make the section the positioning context and render the close button as a sibling of Link. Then you no longer need preventDefault/stopPropagation on the button.
Apply:
- <section className="w-full bg-black" style={{ height: BANNER_HEIGHT }}> - <Link - className="relative flex w/full justify-start px-4 hover:cursor-pointer md:justify-center" + <section className="relative w-full bg-black" style={{ height: BANNER_HEIGHT }}> + <Link + className="flex w-full justify-start px-4 hover:cursor-pointer md:justify-center" style={{ height: BANNER_HEIGHT, background: "linear-gradient(to bottom, #1d1d1d28 0%, #ff1d3828 100%)", }} href="/apply" > @@ - <button - className="absolute right-2 block h-full hover:cursor-pointer md:right-5" - aria-label="배너 닫기" - onClick={(e) => { - e.preventDefault(); - e.stopPropagation(); - hideBanner(); - }} - > - <X color="#fff" /> - </button> - </Link> + </Link> + <button + type="button" + className="absolute right-2 top-0 block h-full hover:cursor-pointer md:right-5" + aria-label="배너 닫기" + onClick={hideBanner} + > + <X color="#fff" /> + </button>Also applies to: 43-54
15-18: Harden portal mounting for SSR and missing containerAccessing document in SSR or when the portal root is absent can throw. Guard and reuse a resolved portal root.
export const Banner = () => { const { isVisible, hideBanner } = useBannerVisibility(); - return ( - isVisible && - createPortal( + if (!isVisible) return null; + const portalRoot = + typeof window !== "undefined" ? document.getElementById(BANNER_PORTAL_ID) : null; + if (!portalRoot) return null; + + return createPortal( <section className="w-full bg-black" style={{ height: BANNER_HEIGHT }}> @@ - </section>, - document.getElementById(BANNER_PORTAL_ID) as HTMLElement, - ) - ); + </section>, + portalRoot as HTMLElement, + );Also applies to: 56-57
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
mosu-app/src/features/banner/ui/Banner.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Run DangerJS
🔇 Additional comments (1)
mosu-app/src/features/banner/ui/Banner.tsx (1)
47-50: Bug fix validated: preventDefault correctly blocks Link navigationAdding e.preventDefault() before stopping propagation prevents the anchor navigation while keeping the banner hide action. This directly addresses Issue #373.
📚 Storybook이 Chromatic에 배포되었습니다!
|



✅ Linked Issue
🔍 What I did
Summary by CodeRabbit