audio – A laptop doesn’t normally switch to the internal speakers if external are connected

If I use headphones, everything works fine. But if I disconnect them, the laptop doesn’t switch to internal speakers and shows that the “Headphones” are connected instead of the “Speakers” unless I physically press (or sometimes just slightly touch) the area to the right of the touchpad (see the image below):

Image source:

I have a Dell Latitude E5520M laptop with Linux Fedora 32 Workstation installed. Before I switched to Linux, I also sometimes experienced similar problems on Windows 10 (I have trying reinstalling the sound card drivers but it was not of the least use).

What can cause such a problem?