diff --git a/src/renderer/components/BaseSelect.vue b/src/renderer/components/BaseSelect.vue
index 9b17e211..4262f19e 100644
--- a/src/renderer/components/BaseSelect.vue
+++ b/src/renderer/components/BaseSelect.vue
@@ -37,6 +37,8 @@
v-if="isOpen"
ref="optionList"
:class="`select__list-wrapper ${dropdownClass ? dropdownClass : '' }`"
+ @mousedown="isMouseDown = true"
+ @mouseup="handleMouseUpEvent()"
>
- {
+ if (isMouseDown.value) return;
deactivate();
emit('blur');
};
+ const handleMouseUpEvent = () => {
+ isMouseDown.value = false;
+ searchInput.value.focus();
+ };
+
+ const handleWheelEvent = (e) => {
+ if (!e.target.className.includes('select__')) deactivate();
+ };
+
onMounted(() => {
window.addEventListener('resize', adjustListPosition);
+ window.addEventListener('wheel', handleWheelEvent);
+
nextTick(() => {
// fix position when the component is created and opened at the same time
if (isOpen.value) {
@@ -336,6 +351,7 @@ export default defineComponent({
});
onUnmounted(() => {
window.removeEventListener('resize', adjustListPosition);
+ window.removeEventListener('wheel', handleWheelEvent);
});
return {
@@ -351,10 +367,12 @@ export default defineComponent({
isSelected,
keyArrows,
isOpen,
+ isMouseDown,
hightlightedIndex,
optionList,
optionRefs,
- handleBlurEvent
+ handleBlurEvent,
+ handleMouseUpEvent
};
}
});