How do I properly install it?
also what package is that?
libSDL or libSDL-dev?
also is it libSDL or libsdl2?
The package in the Ubuntu version you're using does not have the bug fixed. I see that Ubuntu 21.04 (the upcoming version) will have a newer version with the fix I was mentioning before.
You can install it from source, but if it's not something you've done before, I'd say wait for the new Ubuntu version. libsdl2 uses the traditional ./configure; make; make install installation process, common for many open source projects.
You should look into why your controller disconnects - maybe there's an issue with it or the connection to your system.
I followed instructions here, tried to install from ubuntu repo as well as compiled it, but same effect for me.
We don't have instructions for building SDL, if you're referring to the RetroPie install instructions, then I don't think it's any difference how you make the installatio - on a PC the RetroPie packages are always installed from source.