The search bar appears in the mobile version when you press the magnifying glass. I wish the search bar could move under the logo and be active all the time. Can anyone guide me?

I use Magento 2.3.3 with Codazon Infinit theme.

What is currently there (you need to click the search icon to make the search bar appear)

1 Answer 1


in vendor\magento\module-search\view\frontend\web\js\form-mini.js you have function setActiveState in which you have:

this.searchForm.toggleClass('active', isActive);
this.searchLabel.toggleClass('active', isActive);   

which add class to the label and form. If class and form has class active they are shown. You have to override this function

How to override Js file:
create custom module under /app/code/[Vendor]/[Module]. Our Vendor name will be Override and module name Js. So first create file registration.php in app/code/Override/Js


Then under app/code/Override/Js/etc create file module.xml.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Override_Js" setup_version="0.0.1">


Next step is to create file requirejs-config.js

var config = {
    map: {
        '*': {

Last thing to do is to creat your Js file. So create :
with content from:
vendor\magento\module-search\view\frontend\web\js\form-mini.js and make any changes you want.
After this run:

php bin/magento module:enable Override_Js
php bin/magento setup:upgrade   
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:di:compile   

TIP: first put some alert('test'); in the _create: function () { to see if requirejs works. If not follow this link


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.