From fbf6133dfdc6b8e9cb2a765d9fbb43aff1a7ed3d Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Sun, 29 Jul 2018 16:37:17 +0200 Subject: [PATCH] Searchable Select: prevent modal closes when closing a autocompletion dropdown --- .../javascripts/app/lib/app_post/searchable_select.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 810928954..50b2a2cb8 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -140,11 +140,13 @@ class App.SearchableSelect extends Spine.Controller when 39 then @autocompleteOrNavigateIn event # right when 37 then @autocompleteOrNavigateOut event # left when 13 then @onEnter event - when 27 then @onEscape() + when 27 then @onEscape event when 9 then @onTab event onEscape: -> - @toggle() if @isOpen + if @isOpen + event.stopPropagation() # if the input is in a modal, prevent the modal from closing + @toggle() getCurrentOptions: -> @currentMenu.find('.js-option, .js-enter, .js-back')