From 46b3a9c258b866eb15ec4c13219d5c9fdc7ba429 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Dec 2015 18:48:39 +0530 Subject: [PATCH] Set focus on search box when showing search panel --- src/pyj/book_list/search.pyj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pyj/book_list/search.pyj b/src/pyj/book_list/search.pyj index 0e2dc23426..f867bd484c 100644 --- a/src/pyj/book_list/search.pyj +++ b/src/pyj/book_list/search.pyj @@ -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)