Skip to content

Conversation

@toothlessdev
Copy link
Member

@toothlessdev toothlessdev commented Aug 27, 2025

✅ Linked Issue

🔍 What I did

  • 배너 닫기 클릭시 신청하기 페이지로 이동하는 현상 수정

Summary by CodeRabbit

  • Bug Fixes
    • Closing the in-app banner now reliably dismisses it without triggering unintended navigation.
    • Prevents accidental page changes when tapping the banner’s close button, improving interaction consistency across devices.
    • Enhances user experience by ensuring the close action only hides the banner and does not interfere with surrounding links or click targets.

@toothlessdev toothlessdev self-assigned this Aug 27, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 27, 2025

Walkthrough

The 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

Cohort / File(s) Summary
Banner close-handler update
mosu-app/src/features/banner/ui/Banner.tsx
Added e.preventDefault() to the close button’s onClick before e.stopPropagation() and hideBanner() to prevent Link navigation when closing the banner.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix: Banner X click should not navigate and should close [#373]

Assessment against linked issues: Out-of-scope changes

(No out-of-scope changes identified.)

Possibly related PRs

Suggested labels

기능 구현, 도메인 : 공통

Suggested reviewers

  • kimgho

Poem

A nibble, a click—hop, don’t go!
I tapped the X to end the show.
preventDefault, a gentle nudge,
stopPropagation—no more trudge.
The banner fades, I twitch an ear,
Bug burrowed out—carrots cheer! 🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix#373

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Aug 27, 2025

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

Project Deployment Preview Comments Updated (UTC)
mosu-client Ready Ready Preview Comment Aug 27, 2025 4:37pm

@sonarqubecloud
Copy link

@github-actions
Copy link

Warnings
⚠️ PR에 Reviewers가 지정되어 있지 않습니다. 리뷰어를 지정해주세요.
Messages
📖 ✅ PR 제목에 이슈 번호가 포함되어 있습니다.
📖 ✅ PR에 라벨이 지정되어 있습니다.
📖 ✅ PR에 Assignees가 지정되어 있습니다.
📖 ✅ package.json에 변경사항이 없습니다.
📖 ✅ 브랜치 이름 'fix#373'이 컨벤션을 따릅니다.
📖 ✅ TypeScript 컴파일이 성공적으로 완료되었습니다.
📖 ✅ ESLint 검사 결과 문제가 없습니다.

📝 추가 및 변경된 파일

총 1개 파일 변경

└── 📂 mosu-app/
    └── 📂 src/
        └── 📂 features/
            └── 📂 banner/
                └── 📂 ui/
                    └── ⚛️ Banner.tsx

Generated by 🚫 dangerJS against db54b91

@toothlessdev toothlessdev merged commit 13a1452 into main Aug 27, 2025
7 of 8 checks passed
@toothlessdev toothlessdev deleted the fix#373 branch August 27, 2025 16:38
@github-project-automation github-project-automation bot moved this from 진행중 to 완료 in mosu-client Aug 27, 2025
Copy link

@coderabbitai coderabbitai bot left a 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 a11y

A 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 container

Accessing 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.

📥 Commits

Reviewing files that changed from the base of the PR and between a4322ac and db54b91.

📒 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 navigation

Adding e.preventDefault() before stopping propagation prevents the anchor navigation while keeping the banner hide action. This directly addresses Issue #373.

@github-actions
Copy link

📚 Storybook이 Chromatic에 배포되었습니다!

@kimgho kimgho self-requested a review August 29, 2025 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 완료

Development

Successfully merging this pull request may close these issues.

[🐞 버그 리포트] 배너 X 클릭 시 안 닫히고 이동되는 현상 수정

2 participants