From 164829fd7cd30063d3c1a06c261d1f1049b0cc15 Mon Sep 17 00:00:00 2001 From: artoscinote <85488244+artoscinote@users.noreply.github.com> Date: Wed, 7 Jun 2023 09:52:57 +0200 Subject: [PATCH] Fix issue where blur prevention is not turned off in assignment modal dropdown [SCI-8588] (#5570) --- app/javascript/vue/shared/select.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/javascript/vue/shared/select.vue b/app/javascript/vue/shared/select.vue index 198f3cc9a..5d77156d3 100644 --- a/app/javascript/vue/shared/select.vue +++ b/app/javascript/vue/shared/select.vue @@ -77,7 +77,7 @@ this.isOpen = false; this.$emit('blur'); } - }, 200); + }, 100); }, toggle() { if (this.isOpen && this.blurPrevented) { @@ -93,10 +93,7 @@ }); this.$refs.optionsContainer.scrollTop = 0; this.updateOptionPosition(); - setTimeout(() => { - this.$refs.optionsContainer.$el.querySelector('.ps__thumb-y').addEventListener('mousedown', this.preventBlur); - this.$refs.optionsContainer.$el.querySelector('.ps__thumb-y').addEventListener('mouseup', this.allowBlur); - }, 100); + this.setUpBlurHandlers(); } else { this.optionPositionStyle = ''; this.$emit('close'); @@ -121,6 +118,13 @@ } this.optionPositionStyle = `position: fixed; top: ${top}px; left: ${left}px; width: ${width}px` + }, + setUpBlurHandlers() { + setTimeout(() => { + this.$refs.optionsContainer.$el.querySelector('.ps__thumb-y').addEventListener('mousedown', this.preventBlur); + this.$refs.optionsContainer.$el.querySelector('.ps__thumb-y').addEventListener('mouseup', this.allowBlur); + document.addEventListener('mouseup', this.allowBlur); + }, 100); } } }