moinulmoin / chadnext

ChadNext - Quick Starter Template for your Next project includes Next.js 14 App router, Shadcn UI, LuciaAuth, Prisma, Server Actions, Stripe, Internationalization and more.
https://chadnext.moinulmoin.com
MIT License
840 stars 75 forks source link

Login Modal "Close" Button Redirects to Main Page Instead of Staying on the Current Page #237

Closed aliciusschroeder closed 3 weeks ago

aliciusschroeder commented 3 weeks ago

Description: When clicking the "Login" button, a dialog opens where users can enter their email. However, clicking the "x" button in the upper right corner of the dialog redirects users to the main page, which is not intuitive. Users would expect that closing the dialog would keep them on the same page.

Steps to Reproduce:

  1. Navigate to any page other than the main page.
  2. Click the "Login" button to open the login modal.
  3. Click the "x" button in the upper right corner of the dialog.

Expected Behavior: The dialog should close, and the user should remain on the current page.

Actual Behavior: The dialog closes, and the user is redirected to the main page.

Suggested Solution: Modify the behavior of the "x" button to use router.back() instead of router.push("/") to ensure users remain on the current page after closing the dialog.