diff --git a/assets/components/molecules/search/search-mobile.js b/assets/components/molecules/search/search-mobile.js index aa0e9b059..77b72ee13 100644 --- a/assets/components/molecules/search/search-mobile.js +++ b/assets/components/molecules/search/search-mobile.js @@ -2,24 +2,23 @@ export default () => { - $('#search-mobile-toggle').click(function(event){ + $('#search-mobile-toggle').on('click', () => { - var searchContainer = $('.search-mobile'); - var searchField = searchContainer.find('.form-control'); + const searchContainer = $('.search-mobile'); + const searchField = searchContainer.find('.form-control'); searchContainer.toggleClass('show'); $('body').toggleClass('search-open'); - if ( searchContainer.hasClass('show') ) { - searchField.focus(); + if (searchContainer.hasClass('show')) { + searchField.trigger('focus'); } }); - $('#search-mobile-close').click(function(event){ + $('#search-mobile-close').on('click', () => { - var searchContainer = $('.search-mobile'); - var searchField = searchContainer.find('.form-control'); + const searchContainer = $('.search-mobile'); searchContainer.removeClass('show'); $('body').removeClass('search-open'); diff --git a/assets/components/molecules/search/search.js b/assets/components/molecules/search/search.js index 9129663ce..dcaf4b015 100644 --- a/assets/components/molecules/search/search.js +++ b/assets/components/molecules/search/search.js @@ -2,6 +2,6 @@ export default () => { $('.search').on('shown.bs.dropdown', () => { - $('.search input[type="text"]').focus(); + $('.search input[type="text"]').trigger('focus'); }); };