Skip to content

Commit 479933f

Browse files
authored
fix(editor): Make clicking item in RLC work the first time on small screens (#12585)
1 parent 89f93fd commit 479933f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

packages/editor-ui/src/components/ResourceLocator/ResourceLocator.vue

+18-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ import type {
3232
INodePropertyModeTypeOptions,
3333
NodeParameterValue,
3434
} from 'n8n-workflow';
35-
import { computed, nextTick, onBeforeUnmount, onMounted, type Ref, ref, watch } from 'vue';
35+
import {
36+
computed,
37+
nextTick,
38+
onBeforeUnmount,
39+
onMounted,
40+
type Ref,
41+
ref,
42+
useCssModule,
43+
watch,
44+
} from 'vue';
3645
import { useRouter } from 'vue-router';
3746
import ResourceLocatorDropdown from './ResourceLocatorDropdown.vue';
3847
import { useTelemetry } from '@/composables/useTelemetry';
@@ -90,6 +99,7 @@ const workflowHelpers = useWorkflowHelpers({ router });
9099
const { callDebounced } = useDebounce();
91100
const i18n = useI18n();
92101
const telemetry = useTelemetry();
102+
const $style = useCssModule();
93103
94104
const resourceDropdownVisible = ref(false);
95105
const resourceDropdownHiding = ref(false);
@@ -656,7 +666,13 @@ function onListItemSelected(value: NodeParameterValue) {
656666
hideResourceDropdown();
657667
}
658668
659-
function onInputBlur() {
669+
function onInputBlur(event: FocusEvent) {
670+
// Do not blur if focus is within the dropdown
671+
const newTarget = event.relatedTarget;
672+
if (newTarget instanceof HTMLElement && dropdownRef.value?.isWithinDropdown(newTarget)) {
673+
return;
674+
}
675+
660676
if (!isSearchable.value || currentQueryError.value) {
661677
hideResourceDropdown();
662678
}

packages/editor-ui/src/components/ResourceLocator/ResourceLocatorDropdown.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { N8nLoading } from 'n8n-design-system';
55
import type { EventBus } from 'n8n-design-system/utils';
66
import { createEventBus } from 'n8n-design-system/utils';
77
import type { NodeParameterValue } from 'n8n-workflow';
8-
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
8+
import { computed, onBeforeUnmount, onMounted, ref, useCssModule, watch } from 'vue';
99
1010
const SEARCH_BAR_HEIGHT_PX = 40;
1111
const SCROLL_MARGIN_PX = 10;
@@ -50,6 +50,7 @@ const emit = defineEmits<{
5050
}>();
5151
5252
const i18n = useI18n();
53+
const $style = useCssModule();
5354
5455
const hoverIndex = ref(0);
5556
const showHoverUrl = ref(false);
@@ -198,6 +199,12 @@ function onResultsEnd() {
198199
}
199200
}
200201
}
202+
203+
function isWithinDropdown(element: HTMLElement) {
204+
return Boolean(element.closest('.' + $style.popover));
205+
}
206+
207+
defineExpose({ isWithinDropdown });
201208
</script>
202209

203210
<template>

0 commit comments

Comments
 (0)