@@ -61,7 +61,6 @@ const handleInputFocus = (e: KeyboardEvent): void => {
6161 if (e .key === ' k' && (e .metaKey || e .ctrlKey )) {
6262 e .preventDefault ();
6363
64- clearSubstringSearchMatches ();
6564 focusRefSearchInput ();
6665 }
6766};
@@ -80,10 +79,10 @@ const handleSelectKeydownTab = (shiftKey = false) => {
8079 return ;
8180 }
8281
83- const activeSelectOption = document .activeElement ;
84- const activeSelectOptionIndex = activeSelectOption && activeSelectOption .classList .contains (' BaseSelect__option' )
82+ const activeElement = document .activeElement ;
83+ const activeElementIndex = activeElement && activeElement .classList .contains (' BaseSelect__option' )
8584 ? refSelectOptions .value .findIndex ((option : HTMLLIElement ) => {
86- return option .id === activeSelectOption .id ;
85+ return option .id === activeElement .id ;
8786 })
8887 : - 1 ;
8988
@@ -92,7 +91,6 @@ const handleSelectKeydownTab = (shiftKey = false) => {
9291 return ;
9392 }
9493
95- refSelectOptions .value [index ].classList .remove (' Select__option--active' );
9694 refSelectOptions .value [index ].setAttribute (' aria-selected' , ' false' );
9795 };
9896 const updateNext = (index : number ) => {
@@ -101,31 +99,30 @@ const handleSelectKeydownTab = (shiftKey = false) => {
10199 }
102100
103101 refSelectOptions .value [index ].focus ()
104- refSelectOptions .value [index ].classList .add (' Select__option--active' );
105102 refSelectOptions .value [index ].setAttribute (' aria-selected' , ' true' );
106103 };
107104
108- if (activeSelectOptionIndex === - 1 ) {
105+ if (activeElementIndex === - 1 ) {
109106 updateNext (0 );
110107 }
111108 else {
112109 let nextSelectOptionIndex: number ;
113110
114111 if (! shiftKey ) {
115112 // If active index === length of the options, go to start; move forward 1
116- nextSelectOptionIndex = activeSelectOptionIndex === refSelectOptions .value .length - 1
113+ nextSelectOptionIndex = activeElementIndex === refSelectOptions .value .length - 1
117114 ? 0
118- : activeSelectOptionIndex + 1 ;
115+ : activeElementIndex + 1 ;
119116 }
120117 else {
121118 // If active index is at start, go to end; move backward 1
122- nextSelectOptionIndex = ! activeSelectOptionIndex
119+ nextSelectOptionIndex = ! activeElementIndex
123120 ? refSelectOptions .value .length - 1
124- : activeSelectOptionIndex - 1 ;
121+ : activeElementIndex - 1 ;
125122 }
126123
127124 // Update current
128- updateCurrent (activeSelectOptionIndex );
125+ updateCurrent (activeElementIndex );
129126
130127 // Update next
131128 updateNext (nextSelectOptionIndex );
@@ -206,10 +203,6 @@ watch(focused, (focused) => {
206203onBeforeUnmount (() => {
207204 // REMOVE EVENT LISTENERS
208205 window .removeEventListener (' keydown' , handleInputFocus );
209-
210- if (refSelectInput .value ) {
211- refSelectInput .value .removeEventListener (' blur' , handleSelectBlur );
212- }
213206})
214207
215208onMounted (() => {
@@ -242,8 +235,8 @@ onMounted(() => {
242235 >
243236 <li
244237 v-for =" (option, index) in substringSearchMatches"
245- @keydown =" handleSelectKeydown($event, option)"
246238 @click =" handleSelectClick($event, option)"
239+ @keydown =" handleSelectKeydown($event, option)"
247240 :key =" index"
248241 :aria-selected =" false"
249242 class =" Select__option BaseSelect__option"
@@ -281,6 +274,7 @@ onMounted(() => {
281274 }
282275
283276 & __select {
277+ background-color : map .get ($base-color , " body" );
284278 border : none ;
285279 left : 0 ;
286280 position : absolute ;
0 commit comments