Skip to content

Commit

Permalink
Fix search text field not being auto focused NativeScript#938 (Native…
Browse files Browse the repository at this point in the history
  • Loading branch information
etabakov authored Oct 24, 2017
1 parent 12c0cbe commit 34b1872
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions build/_assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,9 @@ $(function() {
var $searchBtn = $('.Search-open');
var $searchBar = $('.Search-container');
var $searchCancel = $('.Btn--cancel');
var $searchInput = $('.Search-input');
var $navLinks = $('.Nav-menu .-fl');
var $navLinksMobileToggle = $('.Nav-open-menu');

// improve search input
$searchInput.attr('placeholder', 'Looking for...');

// improve menu
$navLinks.find('a').each(function() {
if ($(this).attr('href') === document.location.pathname) {
Expand All @@ -292,13 +288,12 @@ $(function() {
$searchBtn.on('click', function() {
$searchBtn.toggleClass('is-active');
$searchBar.toggle();
$searchInput.focus();
$('[name=search]').first().focus();
// hide nav when opening search
$navLinks.removeClass('is-visible');
$navLinksMobileToggle.removeClass('is-active');
});
$searchCancel.on('click', function() {
$searchInput.blur();
$searchBar.toggle();
$searchBtn.toggleClass('is-active');
});
Expand Down

0 comments on commit 34b1872

Please sign in to comment.