Skip to content

Commit

Permalink
Fixed the issue 412 ->Focus to glyphicon-search with necesaary delay (#…
Browse files Browse the repository at this point in the history
…455) (#456)

Co-authored-by: Imvedansh <[email protected]>
Co-authored-by: Imvedansh <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2025
1 parent 85ba416 commit 245d278
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions theme/apache/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@
</div>
</nav>
</header>
<!-- Script is to make the input field ready as soon as user click the search button-->
<!-- script could be simplyfy and shorten in length bootstrap framework -->
<script>
document.addEventListener('DOMContentLoaded', function () {
// Using Bootstrap's event system for dropdowns
$(document).on('shown.bs.dropdown', '.dropdown', function () {
// Check if this is the search dropdown
if ($(this).find('.glyphicon-search').length > 0) {
// Find and focus the search input
setTimeout(function() {
$('.pagefind-ui__search-input').focus();
}, 50); // Small delay to ensure input is ready
}
});
});
</script>
<!-- / Navigation -->
<header id="main-header" class="container">
<div class="sideImg">
Expand Down

0 comments on commit 245d278

Please sign in to comment.