File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
packages/theme/components Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 108108 :value =" term"
109109 @input =" handleSearch"
110110 @keydown.enter =" handleSearch($event)"
111+ @keydown.tab =" hideSearch"
111112 @focus =" isSearchOpen = true"
112113 @keydown.esc =" closeSearch"
113114 >
131132 class =" sf-search-bar__button sf-button--pure"
132133 aria-label =" Open search"
133134 @click =" isSearchOpen ? isSearchOpen = false : isSearchOpen = true"
135+ @focus =" showSearch"
136+ @keydown.tab =" hideSearch"
134137 >
135138 <span class =" sf-search-bar__icon" >
136139 <SfIcon
@@ -263,11 +266,21 @@ export default defineComponent({
263266 ]);
264267 });
265268
266- const closeSearch = () => {
267- if (! isSearchOpen .value ) return ;
269+ const showSearch = () => {
270+ if (! isSearchOpen .value ) {
271+ isSearchOpen .value = true ;
272+ }
273+ };
268274
275+ const hideSearch = () => {
276+ if (isSearchOpen .value ) {
277+ isSearchOpen .value = false ;
278+ }
279+ };
280+
281+ const closeSearch = () => {
282+ hideSearch ();
269283 term .value = ' ' ;
270- isSearchOpen .value = false ;
271284 };
272285
273286 const handleSearch = debounce (async (paramValue ) => {
@@ -321,6 +334,8 @@ export default defineComponent({
321334 categoryTree,
322335 closeOrFocusSearchBar,
323336 closeSearch,
337+ showSearch,
338+ hideSearch,
324339 getAgnosticCatLink,
325340 handleAccountClick,
326341 handleSearch,
You can’t perform that action at this time.
0 commit comments