Skip to content

Commit a1c6569

Browse files
committed
don't focus the search input while fetching
When triggering a search the input field would receive focus again when the spinner page shows. On mobile this is annoying, as the keyboard pops up again for no reason.
1 parent d568a7a commit a1c6569

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

www/app/views/movies/show.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= render 'shared/search_box'
1+
= render 'shared/search_box', autofocus: !@fetching
22

33
- if @fetching
44
section.box.padded

www/app/views/shared/_search_box.html.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/# locals: (query: nil)
1+
/# locals: (query: nil, autofocus: true)
22
33
section.box.padded[
44
data-controller="search-autocomplete"
@@ -14,7 +14,7 @@ section.box.padded[
1414
value=query
1515
data-search-autocomplete-target="input"
1616
data-action="click->search-autocomplete#reopen"
17-
autofocus=true
17+
autofocus=autofocus
1818
]
1919

2020
dialog data-dialog-target='dialog'

0 commit comments

Comments
 (0)