Focus search field after it's cleared, ready for immediate typing of new search term on mobile

This commit is contained in:
Matt-Yorkley
2020-05-02 11:18:28 +02:00
parent e0cb514cad
commit 71fb3b1845
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
Darkswarm.directive "focusSearch", ->
restrict: 'A'
link: (scope, element, attr)->
element.bind 'click', (event) ->
# Focus seach field, ready for typing
$(element).siblings('#search').focus()

View File

@@ -6,7 +6,7 @@
placeholder: t(:products_search),
"ng-debounce" => "200",
"ofn-disable-enter" => true}
%a.clear{type: 'button', ng: {show: 'query', click: 'clearQuery()'}}
%a.clear{type: 'button', ng: {show: 'query', click: 'clearQuery()'}, 'focus-search' => true}
%img{ src: "/assets/icn-close.png" }
.hide-for-large-up