简体   繁体   中英

Flex lost cursor in textInput after pop-up is open

I open a pop-up when I start typing in a text input and when it opens - the cursor in the text input disappears. Clicking with the mouse on the text input seems to restore the cursor, and that's why I fixed this issue with dispatching MouseEvent.CLICK on every key stroke.

Is there any cleaner way to handle this disappearing of the cursor?

Edit: The code is something like this:

<s:PopUpAnchor id="popUp"  displayPopUp="false"/>
<s:TextInput id="inputTxt" />


inputTxt.addEventListener(KeyboardEvent.KEY_DOWN, onInputFieldKeyDown);

private funcition onInputFieldKeyDown(event:KeyboardEvent):void {
   if (!popUp.displayPopUp){
      popUp.displayPopUp = true;
   }

   inputTxt.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}

Try to use

tabFocusEnabled="false"

for your s:PopUpAnchor

Actually I found the same issue in Adobe's forums: https://forums.adobe.com/thread/836538 and the guy who posted it also noticed that the cursor re-appears after a mouse click in the input. So I believe that dispatching a mouse event once is acceptable workaround.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM