44-->
55<template >
66 <div class =" cell-selection" >
7- <div v-if =" !isEditing" class =" non-edit-mode" @click =" startEditing " >
7+ <div v-if =" !isEditing" class =" non-edit-mode" @click =" handleStartEditing " >
88 {{ column.getLabel(value) }}<span v-if =" isDeleted()" :title =" t('tables', 'This option is outdated.')" >  ; ⚠️</span >
99 </div >
1010 <div v-else
@@ -56,6 +56,12 @@ export default {
5656 },
5757 },
5858
59+ data () {
60+ return {
61+ isInitialEditClick: false ,
62+ }
63+ },
64+
5965 computed: {
6066 getOptions () {
6167 return this .column ? .selectionOptions || []
@@ -71,24 +77,29 @@ export default {
7177 isEditing (isEditing ) {
7278 if (isEditing) {
7379 this .initEditValue ()
74- // Use a small delay to prevent the same click event that triggered editing
75- // from immediately triggering the click outside handler
76- // TODO: implement better click outside detection without setTimeout
80+ // Add click outside listener after the current event loop
81+ // to avoid the same click that triggered editing from closing the editor
7782 this .$nextTick (() => {
78- setTimeout (() => {
79- document .addEventListener (' click' , this .handleClickOutside )
80- }, 10 )
83+ document .addEventListener (' click' , this .handleClickOutside )
8184 })
8285 } else {
8386 // Remove click outside listener
8487 document .removeEventListener (' click' , this .handleClickOutside )
88+ this .isInitialEditClick = false
8589 }
8690 },
8791 },
8892
8993 methods: {
9094 t,
9195
96+ handleStartEditing (event ) {
97+ this .isInitialEditClick = true
98+ this .startEditing ()
99+ // Stop the event from propagating to avoid immediate click outside
100+ event .stopPropagation ()
101+ },
102+
92103 isDeleted () {
93104 return this .column .isDeletedLabel (this .value )
94105 },
@@ -122,6 +133,12 @@ export default {
122133 },
123134
124135 handleClickOutside (event ) {
136+ // Ignore the initial click that started editing
137+ if (this .isInitialEditClick ) {
138+ this .isInitialEditClick = false
139+ return
140+ }
141+
125142 // Check if the click is outside the editing container
126143 if (this .$refs .editingContainer && ! this .$refs .editingContainer .contains (event .target )) {
127144 this .saveChanges ()
@@ -141,6 +158,11 @@ export default {
141158 }
142159}
143160
161+ : deep (.vs__dropdown - toggle ) {
162+ border: var (-- vs- border- width) var (-- vs- border- style) var (-- vs- border- color);
163+ border- radius: var (-- vs- border- radius);
164+ }
165+
144166.edit - mode {
145167 .icon - loading- inline {
146168 margin- left: 4px ;
0 commit comments