Set focus on search box when showing search panel

This commit is contained in:
Kovid Goyal 2015-12-04 18:48:39 +05:30
parent faea3a7564
commit 46b3a9c258

View File

@ -43,6 +43,11 @@ class SearchPanel:
event.preventDefault(), event.stopPropagation()
)
def init(self):
tb = self.container.querySelector('input[name="search-books"]')
tb.focus()
tb.setSelectionRange(0, tb.value.length)
@property
def container(self):
return document.getElementById(self.container_id)