Skip to content

fix(css): improve mobile responsiveness for navbar search and header#310

Open
shubhtrek wants to merge 2 commits into
kmesh-net:mainfrom
shubhtrek:fix/mobile-navbar-search-responsiveness
Open

fix(css): improve mobile responsiveness for navbar search and header#310
shubhtrek wants to merge 2 commits into
kmesh-net:mainfrom
shubhtrek:fix/mobile-navbar-search-responsiveness

Conversation

@shubhtrek
Copy link
Copy Markdown
Contributor

On screens narrower than 996px the search input was expanding to its full intrinsic width, squeezing the logo and hamburger toggle out of view. Category labels inside the lunr-search results modal would also wrap awkwardly or get truncated on sub-400px viewports.

Changes in src/css/custom.css:

  • Constrain .navbar__search to max-width: 160px on mobile so the logo and hamburger always have room (flex-shrink + min-width: 0).
  • Hide DocSearch placeholder text on mobile (icon-only saves space).
  • Below 400px: collapse the search box to icon-only width (2.2rem), reduce navbar horizontal padding, lock .navbar__brand with flex-shrink: 0 to prevent logo clipping.
  • In the lunr-search results dropdown: apply text-overflow: ellipsis to category headings, clamp snippet text to 2 lines, tighten padding.
  • At 400px and below: stretch the results modal to 100vw with a 60vh max-height and scroll, so it never clips outside the viewport.

Fixes #304

Copilot AI review requested due to automatic review settings May 17, 2026 17:57
@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for kmesh-net ready!

Name Link
🔨 Latest commit f72895b
🔍 Latest deploy log https://app.netlify.com/projects/kmesh-net/deploys/6a0bd3fb3f70ec0008b5e7c0
😎 Deploy Preview https://deploy-preview-310--kmesh-net.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevin-wangzefeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces CSS media queries to enhance the mobile responsiveness of the search bar and search results modal. Feedback was provided regarding the usability of the search input on screens smaller than 400px, where a zero font size and restricted width hinder user interaction and trigger unwanted iOS zoom behavior. Additionally, a suggestion was made to remove redundant width properties in the search results modal to prevent potential horizontal overflow.

Comment thread src/css/custom.css
Comment on lines +219 to +231
.navbar__search {
max-width: 2.2rem; /* just wide enough for the search icon */
overflow: hidden;
}

.navbar__search-input {
font-size: 0;
padding: 0 0.3rem;
}

.navbar__search-input::placeholder {
font-size: 0; /* hide placeholder text, keep the box clickable */
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

On screens narrower than 400px, the search input is collapsed to a max-width of 2.2rem and the font-size is set to 0. This makes the search functionality effectively unusable because the user cannot see what they are typing. Furthermore, setting a font-size below 16px (including 0) triggers an automatic zoom-in on iOS Safari when the input is focused, which is a poor user experience. Consider allowing the search bar to expand when it has focus (e.g., using :focus-within) or maintaining a readable font size.

Comment thread src/css/custom.css Outdated
Comment on lines +287 to +289
left: 0 !important;
right: 0 !important;
width: 100vw !important;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Combining left: 0, right: 0, and width: 100vw is redundant and potentially problematic. left: 0 and right: 0 will naturally stretch the element to the full width of its positioning context. Explicitly setting width: 100vw can cause horizontal overflow on mobile devices where the viewport width includes the scrollbar, or if the element's parent is not the full width of the viewport.

Suggested change
left: 0 !important;
right: 0 !important;
width: 100vw !important;
left: 0 !important;
right: 0 !important;

On screens narrower than 996px the search input was expanding to its
full intrinsic width, squeezing the logo and hamburger toggle out of
view.  Category labels inside the lunr-search results modal would also
wrap awkwardly or get truncated on sub-400px viewports.

Changes in src/css/custom.css:
- Constrain .navbar__search to max-width: 160px on mobile so the logo
  and hamburger always have room (flex-shrink + min-width: 0).
- Hide DocSearch placeholder text on mobile (icon-only saves space).
- Below 400px: collapse the search box to icon-only width (2.2rem),
  reduce navbar horizontal padding, lock .navbar__brand with
  flex-shrink: 0 to prevent logo clipping.
- In the lunr-search results dropdown: apply text-overflow: ellipsis
  to category headings, clamp snippet text to 2 lines, tighten padding.
- At 400px and below: stretch the results modal to 100vw with a 60vh
  max-height and scroll, so it never clips outside the viewport.

Fixes kmesh-net#304

Signed-off-by: Shubh Pingale <135618936+shubhtrek@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates global Docusaurus CSS to improve mobile navbar/search behavior and search-results readability for issue #304.

Changes:

  • Constrains navbar search sizing on mobile and very small screens.
  • Adds mobile-specific styling for lunr/DocSearch-style search result dropdown content.
  • Makes very small search results containers span the viewport width with scrolling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/css/custom.css Outdated
Comment on lines +222 to +225
}

.navbar__search-input {
font-size: 0;
@shubhtrek shubhtrek force-pushed the fix/mobile-navbar-search-responsiveness branch from ac684bd to 509ac8a Compare May 17, 2026 18:00
@yashisrani
Copy link
Copy Markdown
Contributor

@shubhtrek can you attach screenshots about this new changes ?

Copilot AI review requested due to automatic review settings May 19, 2026 03:07
@kmesh-bot
Copy link
Copy Markdown
Collaborator

Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages.

The list of commits with invalid commit messages:

  • 509ac8a fix(css): improve mobile responsiveness for navbar search and header
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@shubhtrek
Copy link
Copy Markdown
Contributor Author

hey for this PR i want some time cause I solved but a I get one more issue in that so I am solving this and then I try to Pr again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI/UX] Improve Mobile Responsiveness for Search and Navbar

4 participants