77
Views
3
Comments
Solved
[OutSystems UI Web] Default modal action launched without opening the modal
Question
outsystems-ui-web
Web icon
Forge asset by OutSystems

Hi, we have a weird problem.

We have a modal, which has two buttons, one of them set to the default button.

We have realized that, for some reason, this modal is rendered in the HTML in the KeyPress of all the inputs of the page, as indicated in the photo.

Due to this, we have had a bug in which a user has launched the keypress when entering with the keyboard, the modal has not been opened, but has executed its default action.

We have reviewed all the code but we have not seen the reason why it is associated with the inputs and worse, because it has not been opened in that case and has directly launched the default action



Can you help us?

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @CrisSanz 

Any update on this? Have you managed to solve this issue? 
If so, can you share the solution with the community? 

I just created a quick test and by adding a new handler to the button you can prevent that (even though I was not able to reproduce the scenario you mentioned):

Cheers,
GM

2018-08-03 14-17-33
Carlos Escórcio

I had a similar issue, so i added a JS forbidding that modal to open

 if (keyPressed && keyPressed > 36 && keyPressed  < 13) {

        ev.preventDefault();

        ev.stopPropagation();

}

UserImage.jpg
outsystems México

You can use this Javascript in your Screen--> Advanced--> Javascript

$(document).ready(function() {  

$(window).keydown(function(event){    

if(event.keyCode == 13) {        

console.log('keypress event');      

event.preventDefault();      

return false;    }  

});

});

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @CrisSanz 

Any update on this? Have you managed to solve this issue? 
If so, can you share the solution with the community? 

I just created a quick test and by adding a new handler to the button you can prevent that (even though I was not able to reproduce the scenario you mentioned):

Cheers,
GM

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.