From 89e3f24e29e6aa0a002d65bb407e77c26d5c3842 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Fri, 29 May 2020 22:44:58 +0800 Subject: [PATCH] feat: select all text when focus search bar --- src/components/SearchBar.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index 96462e7..1d4015f 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -16,7 +16,10 @@ export function SearchBar({ onSearch, onFocus, searchKey }: Props) { { + onFocus(e) + e.target.select() + }} tabIndex={0} className={cx('search-input', { error: !isValidRegexpSource(searchKey),