This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9d06ca5  jewel-combobox: solve a bug where clicking on popup scrollbar 
was making the popup close
9d06ca5 is described below

commit 9d06ca5727cc269b5871cfb3677d900748ced971
Author: Carlos Rovira <[email protected]>
AuthorDate: Sun Jun 14 19:21:41 2020 +0200

    jewel-combobox: solve a bug where clicking on popup scrollbar was making 
the popup close
---
 .../jewel/beads/controllers/ComboBoxController.as  | 38 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ComboBoxController.as
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ComboBoxController.as
index 1c99980..a008f8e 100644
--- 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ComboBoxController.as
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controllers/ComboBoxController.as
@@ -114,7 +114,7 @@ package org.apache.royale.jewel.beads.controllers
                        
IEventDispatcher(viewBead.textinput).addEventListener(KeyboardEvent.KEY_DOWN, 
textInputKeyEventHandler);
             COMPILE::JS{
                        //keyboard navigation from textfield should also close 
the popup
-                       viewBead.textinput.element.addEventListener('blur', 
handleFocusOut);
+                       viewBead.textinput.element.addEventListener('blur', 
handleTextInputFocusOut);
                        }
                }
 
@@ -143,6 +143,10 @@ package org.apache.royale.jewel.beads.controllers
                        list.addEventListener(KeyboardEvent.KEY_DOWN, 
listKeyEventHandler);
                        list.addEventListener(Event.CHANGE, changeHandler);
                        list.addEventListener(MouseEvent.CLICK, 
listClickHandler);
+                       COMPILE::JS{
+                       //keyboard navigation from textfield should also close 
the popup
+                       list.element.addEventListener('blur', 
handleListFocusOut);
+                       }
             if (model is IJewelSelectionModel) {
                                //don't let the pop-up's list take over as 
primary dispatcher
                                //it needs to stay with the ComboBox (for 
selection bindings to work)
@@ -208,20 +212,40 @@ package org.apache.royale.jewel.beads.controllers
 
                protected function handleControlMouseDown(event:MouseEvent):void
                {
+                       list.setFocus();
                        event.stopImmediatePropagation();
                }
-
         /**
          * @private
          */
-        protected function handleFocusOut(event:Event):void
+        protected function handleTextInputFocusOut(event:Event):void
         {
-            if (viewBead.popUpVisible) {
+                       if (viewBead.popUpVisible) {
                                //allow a time to handle a selection from
                                //the popup as the possible reason for loss of 
focus
                                //(event.relatedObject seems null, so cannot 
check here)
                                //this should be less than 300
-                setTimeout(dismissPopUp, 280);
+                setTimeout(textInputDismissPopUp, 280); // ret
+            }
+        }
+
+               protected function textInputDismissPopUp():void
+               {
+                       COMPILE::JS
+                       {
+                       if (isFocused(list))
+                               return; 
+                       }
+                       dismissPopUp();
+               }
+
+        /**
+         * @private
+         */
+        protected function handleListFocusOut(event:Event):void
+        {
+                       if (viewBead.popUpVisible) {
+                               setTimeout(dismissPopUp, 280); //ret
             }
         }
                
@@ -273,6 +297,10 @@ package org.apache.royale.jewel.beads.controllers
                                list.removeEventListener(Event.CHANGE, 
changeHandler);
                                
list.removeEventListener(KeyboardEvent.KEY_DOWN, listKeyEventHandler);
                                list.removeEventListener(MouseEvent.CLICK, 
listClickHandler);
+                               COMPILE::JS{
+                               //keyboard navigation from textfield should 
also close the popup
+                               list.element.removeEventListener('blur', 
handleListFocusOut);
+                               }
                                viewBead.popUpVisible = false;
                        }
                        keyPressed = false;

Reply via email to