Moving search bar below sticky bar on mobile

Topic summary

A user seeks to reposition the mobile search bar in the Focal theme so it appears below the sticky header instead of overlapping it.

Current Issue:

  • Search bar currently overlays the sticky header on mobile devices
  • User wants it positioned underneath, similar to a reference example shown via screenshots

Proposed Solutions:

One responder requested the store URL for direct troubleshooting.

Another provided detailed technical guidance involving:

  • CSS positioning adjustments: Modify .search-drawer to use position: absolute with top: 100% on mobile viewports
  • DOM restructuring: Move the search drawer Liquid code ({% render 'search-drawer' %}) outside the <header> element in header.liquid
  • Z-index management: Ensure header has higher z-index (20) than search drawer (10)
  • Optional styling: Add background color and box-shadow for visual separation

The solution includes code snippets for both CSS modifications and Liquid template restructuring. The discussion remains open pending implementation feedback from the original poster.

Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

How can we move the search bar below the header on mobile for Focal theme?

current theme

Screenshot 2025-05-13 at 9.30.09 AM.png

example

Screenshot 2025-05-13 at 9.30.50 AM.png

1 Like

Hi @r_atp29 , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks

Hello @r_atp29 To move the search bar below the sticky header on mobile in the Focal theme (by Maestrooo), you’ll need to modify the Liquid and/or CSS logic that controls how and where the search drawer appears.

Goal
Make the search bar open under the sticky header instead of overlapping it.

Steps to Move Search Below Sticky Header on Mobile

  1. Identify the Sticky Header
    In the Focal theme, the header is typically sticky using CSS like this:
.header {
  position: sticky;
  top: 0;
  z-index: 10; /* or higher */
}
  1. Find the Search Drawer Code
    Look in:

. header.liquid or header-group.liquid

. Or check search-drawer.liquid or component-search-drawer.liquid

You’ll likely see a block like:


This drawer is positioned absolutely or fixed, making it appear over the header.

  1. Edit the Drawer Positioning
    Option A: Use position: absolute below header
    Update CSS for .search-drawer like this:
@media screen and (max-width: 749px) {
  .search-drawer {
    position: absolute;
    top: 100%;
    z-index: 9;
  }

  .header--sticky + .search-drawer {
    top: calc(var(--header-height)); /* if header has a height variable */
  }
}

Option B: Wrap Search Drawer Outside Header
If the search drawer is inside the , move it outside the sticky header element in the DOM structure.

. Open header.liquid

. Find the search drawer include like:

{% render 'search-drawer' %}

. Cut it from inside the header

. Paste it just after the closing

Example:


{% render 'search-drawer' %}
  1. Tweak Z-Index if Needed
    You may need to set:
.header {
  z-index: 20;
}
.search-drawer {
  z-index: 10;
}

Final Touch (Optional)
If the drawer has a background and covers content below, add:

.search-drawer {
  background: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

Thank you :blush: