Skip to content

fix: prevent desktop navbar from redirecting on touch devices#386

Open
debayanCODES-1 wants to merge 1 commit into
keploy:mainfrom
debayanCODES-1:feat/mobile-navbar-fix
Open

fix: prevent desktop navbar from redirecting on touch devices#386
debayanCODES-1 wants to merge 1 commit into
keploy:mainfrom
debayanCODES-1:feat/mobile-navbar-fix

Conversation

@debayanCODES-1
Copy link
Copy Markdown

@debayanCODES-1 debayanCODES-1 commented May 6, 2026

Fixes: keploy/keploy#3431

The Problem:
Currently, when viewing the Keploy Blog on an iPad or large tablet (devices that render the desktop navigation bar but lack native hover support), interacting with the "Technology" or "Community" dropdowns results in a poor user experience. Because touch devices interpret a tap on a as an immediate click event, users are instantly redirected to the category pages instead of opening the mega-menu dropdown to view its contents.

The Solution:
This PR resolves the issue by intelligently intercepting the onClick event on these navigation links specifically for touch devices, allowing them to act natively as dropdown toggles.

Key Changes:

Updated the Link components in components/navbar/FloatingNavbarClient.tsx for the "Technology" and "Community" desktop navigation items.
Implemented a precise touch-device check using the modern window.matchMedia('(hover: none) and (pointer: coarse)').matches API.
If a touch device is detected, the click event correctly calls e.preventDefault() to block the hard redirect and dynamically toggles the mega-menu's visibility state (setShowTechDropdown / setShowCommunityDropdown).

Testing Performed
Tablet/Touch Simulation: Verified via Chrome DevTools (Device Toolbar -> iPad) that tapping "Technology" and "Community" smoothly drops down the glassmorphism mega-menu options instead of redirecting the user.
Desktop Functionality: Confirmed that the standard desktop browser hover functionality (onMouseEnter / onMouseLeave) remains completely unaffected for mouse users.

Type of Change
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist
My code follows the style guidelines of this project
I have performed a self-review of my own code
I have added the standard DCO sign-off (-s) to my commits

Signed-off-by: Debayan <debayanpaulofficial2024@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[blog-website]: Fix blog navbar dropdown ui on mobile devices

1 participant