Vaadin - CustomField focus - Mozilla problem

Hello,

I got modal dialog with custom field with TextArea content. My TextArea got focus listener that open dialog window. When I use Chrome or Edge dialog stay opened, but when I focus on TextArea using Mozilla my dialog open and close with each focus.

When i close Mozilla and reopen its work only for first focus click and for next focus its just open and close dialog.

Do any of you got similar problem ?

I created an issue about this https://github.com/vaadin/vaadin-custom-field/issues/98.

I was able to reproduce on Firefox and Chromium

Dear Rafal,

Reason why it’s happening the described way is because focus listener is triggered within next roundtrip to server.

If field is clicked quickly enough click event won’t trigger closing of the dialog (as it comes within the same roundtrip and focus didn’t open the dialog yet).

If there is a delay between pressing the mouse key and releasing it, focus event will open the dialog and click (that occurs on releasing the mouse key) will close the dialog afterwards.

I would recommend to add a separate button to the UI in order to open dialog if your intention is to modify the value of the custom-field inside that one. If extra details need to be provided inside the dialog without changing the value, vaadin-notification could help in that case.

Best regards,
Yuriy

This resolve my problem on mozzila browser:


dialog.setCloseOnOutsideClick(false);

dialog.addOpenedChangeListener(e->{

           if(e.isOpened()){
               try {
                   Thread.sleep(100);
                   dialog.setCloseOnOutsideClick(true);

               } catch (InterruptedException interruptedException) {
                   interruptedException.printStackTrace();
               }
           }
           else{
               dialog.setCloseOnOutsideClick(false);
           }

       });