This commit is contained in:
Kovid Goyal 2015-12-21 11:05:18 +05:30
parent 9f426ed9c1
commit 87cb403f60

View File

@ -29,17 +29,18 @@ class SearchPanel:
# Build search input # Build search input
search_container = div.firstChild.nextSibling search_container = div.firstChild.nextSibling
search_button = create_button(_('Search'), icon='search', action=self.execute_search.bind(self), tooltip=_('Do the search'))
search_container.appendChild(E.div(style="display: flex; width: 100%;", search_container.appendChild(E.div(style="display: flex; width: 100%;",
E.input( E.input(
type='text', autocomplete='on', autosave='search', inputmode='latin', name='search-books', type='text', autocomplete='on', autosave='search', inputmode='latin', name='search-books',
title=_('Search for books'), placeholder=_('Enter the search query'), spellcheck='false', title=_('Search for books'), placeholder=_('Enter the search query'), spellcheck='false',
style=str.format("flex-grow: 10; padding: {} 0.5em; margin-right: 0.5em", BUTTON_VPADDING) style=str.format("flex-grow: 10; padding: {} 0.5em; margin-right: 0.5em", BUTTON_VPADDING)
), ),
create_button(_('Search'), icon='search', action=self.execute_search.bind(self), tooltip=_('Do the search')) search_button
)) ))
search_container.firstChild.firstChild.addEventListener('keypress', def(event): search_container.firstChild.firstChild.addEventListener('keypress', def(event):
if event.keyCode == 13: if event.keyCode == 13:
self.container.querySelector('button').focus() search_button.focus()
self.execute_search() self.execute_search()
event.preventDefault(), event.stopPropagation() event.preventDefault(), event.stopPropagation()
) )