I finally found the solution to my problem, and without having to do any javascript code.
I'm working in C# ASP.NET. I added a Panel with a DefaultButton and this completely solves the problem. I hope this can be helpful to anyone else who runs into this issue because I wasn't able to get any help on this problem otherwise.