Skip to content

fix(ui): prevent search bar and toggle clipping on mobile viewports - #1367

Open
Yashisinghal285 wants to merge 2 commits into
layer5io:masterfrom
Yashisinghal285:fix/mobile-search-bar-overflow
Open

Yashisinghal285 wants to merge 2 commits into
layer5io:masterfrom
Yashisinghal285:fix/mobile-search-bar-overflow

Conversation

@Yashisinghal285

@Yashisinghal285 Yashisinghal285 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Ensure .td-sidebar__search .td-search shrinks flexibly with min-width: 0 and flex: 1 1 auto, set .td-sidebar__toggle to flex: 0 0 auto, and apply symmetric mobile padding and clear negative margins on .td-sidebar-nav to prevent horizontal overflow on mobile viewports.

Fixes #1366

Notes for Reviewers

This PR fixes #1366 where the search bar and toggle button were cut off on mobile viewports (especially prominent in Firefox and viewports around 414px or smaller).

Key Changes:

  1. Flexbox Constraints on Mobile Search (_search_project.scss):

    • Configured .td-sidebar__search .td-search with flex: 1 1 auto; min-width: 0; width: auto; max-width: 100%, allowing the search input container to shrink flexibly below intrinsic content sizes in Firefox and other browsers.
    • Set .td-search__input with min-width: 0; width: 100%.
    • Set .td-sidebar__toggle to flex: 0 0 auto to prevent the toggle button from shrinking or overflowing.
  2. Mobile Padding & Margin Normalization (_resizable-bootstrap-overrides.scss, _styles_project.scss):

    • Applied symmetric horizontal padding (padding-left: 0.75rem; padding-right: 0.75rem;) to .td-sidebar on viewports < 992px (below lg) to remove the previous asymmetric 0 right padding.
    • Cleared negative margins (margin-left: 0; margin-right: 0;) on .td-sidebar-nav on mobile to prevent the expanded section navigation items and active borders from clipping horizontally.

Verification:

  • Tested responsive emulation at 414px × 846px (and smaller screens).
  • Verified both collapsed and expanded sidebar navigation states to ensure no horizontal clipping or unintended overflow occurs.

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • Style
    • Adjusted sidebar spacing and navigation margins on smaller screens.
    • Updated the sidebar search layout to use the available width more effectively while keeping space for the toggle.
    • Kept the sidebar height flexible on smaller screens for a more consistent responsive layout.

Ensure .td-sidebar__search .td-search shrinks flexibly with min-width: 0 and flex: 1 1 auto, set .td-sidebar__toggle to flex: 0 0 auto, and apply symmetric mobile padding and clear negative margins on .td-sidebar-nav to prevent horizontal overflow on mobile viewports.

Fixes layer5io#1366

Signed-off-by: Yashi <yashi.singhal410@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3d3fd7f-ccac-4ce1-ab86-02b0baba5829
Commits

Reviewing files that changed from the base of the PR and between 20cd983 and 5d58f69.

Files selected for processing: 1
  • assets/scss/_search_project.scss
Files skipped from review as they are similar to previous changes: 1
  • assets/scss/_search_project.scss

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The sidebar search now uses a full-width flex layout that allows the search area to shrink while keeping the toggle at its intrinsic width. Mobile sidebar styles add horizontal padding, and sidebar navigation margins are set to zero.

Changes: Sidebar search layout

Layer / File(s) Summary
Search layout and sidebar spacing
assets/scss/_search_project.scss, assets/scss/_resizable-bootstrap-overrides.scss, assets/scss/_styles_project.scss
The search and toggle use a full-width flex row. The search area can shrink, while the toggle does not. Mobile sidebar styles add horizontal padding and set navigation margins to zero.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Suggested reviewers: rahmanaisha, maanvi212006

Merge Risk: Minimal · up to 5d58f

The mobile layout changes appear ready to merge after normal checks; no actionable issue remains established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing mobile search bar and toggle clipping. It matches the responsive sidebar CSS changes.
Linked Issues check Passed Issue #1366 requires the search bar to fit the available width without clipping or horizontal overflow. The PR adds mobile flex sizing, min-width: 0, width limits, and width: 100% for the search e…
Out of Scope Changes check Passed The changes are limited to sidebar SCSS. The toggle, padding, and navigation margin changes support the same responsive clipping and overflow problem described in issue #1366. No unrelated product beh…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #1366 requires the search bar to fit the available width without clipping or horizontal overflow. The PR adds mobile flex sizing, min-width: 0, width limits, and width: 100% for the search elements. It keeps the toggle from shrinking and normalizes sidebar padding and navigation margins. These changes address the reported mobile layout failure and preserve desktop behavior by scoping the search rules to mobile widths.

Full details: Out of Scope Changes check

Explanation

The changes are limited to sidebar SCSS. The toggle, padding, and navigation margin changes support the same responsive clipping and overflow problem described in issue #1366. No unrelated product behavior or files are identified.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview deployment: https://docs.layer5.io/pr-preview/pr-1367/

Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment here

@rahmanaisha rahmanaisha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice fix, and the diagnosis is spot on: the min-width: 0 chain on the search container and input is exactly what stops a flex item from refusing to shrink below its intrinsic content size, which is the classic Firefox overflow here. The symmetric 0.75rem padding and the cleared nav margins in the other two files round it out well, and the values agree across the two breakpoints so there is no conflict between them.

One scoping question below: the new flex block in _search_project.scss applies at every width, while the description frames it as a mobile fix and the other two changes are scoped below lg. If mobile-only is the intent, scoping it the same way keeps desktop layout untouched. Everything else looks ready.

Comment thread assets/scss/_search_project.scss Outdated
Comment on lines +88 to +112
.td-sidebar {
.td-sidebar__search {
display: flex;
align-items: center;
width: 100%;
max-width: 100%;
box-sizing: border-box;

.td-search {
flex: 1 1 auto;
min-width: 0;
width: auto;
max-width: 100%;
}

.td-search__input {
width: 100%;
min-width: 0;
}

.td-sidebar__toggle {
flex: 0 0 auto;
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This block is unconditional, so it also changes the desktop search row (for example width: 100% on the container), while the PR description frames it as a mobile fix and the other two changes here are scoped below lg. If mobile-only is the intent, wrapping it in the same below-lg breakpoint this file already uses keeps desktop untouched:

Suggested change
.td-sidebar {
.td-sidebar__search {
display: flex;
align-items: center;
width: 100%;
max-width: 100%;
box-sizing: border-box;
.td-search {
flex: 1 1 auto;
min-width: 0;
width: auto;
max-width: 100%;
}
.td-search__input {
width: 100%;
min-width: 0;
}
.td-sidebar__toggle {
flex: 0 0 auto;
}
}
}
@media (max-width: 991.98px) {
.td-sidebar {
.td-sidebar__search {
display: flex;
align-items: center;
width: 100%;
max-width: 100%;
box-sizing: border-box;
.td-search {
flex: 1 1 auto;
min-width: 0;
width: auto;
max-width: 100%;
}
.td-search__input {
width: 100%;
min-width: 0;
}
.td-sidebar__toggle {
flex: 0 0 auto;
}
}
}
}

If the desktop restatement is deliberate, no change needed - just worth confirming, since the description says mobile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thank you! I've updated the PR to scope the .td-sidebar__search flex block inside @media (max-width: 991.98px) to ensure the desktop layout remains completely untouched and aligns with the other below-lg changes.

Wrap .td-sidebar__search flexbox rules in @media (max-width: 991.98px) to align with below-lg mobile scoping and avoid modifying desktop search styles.

Signed-off-by: Yashi <yashi.singhal410@gmail.com>

This branch has not been deployed

No deployments
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] Search bar is clipped on mobile viewports on the Kanvas documentation page

2 participants