The keyboard uses a USB protocol to communicate with the computer. I don't imagine that a loose connector would cause only those to fail. The nature of the connector doesn't lend itself to that kind of behavior either. I suspect a pinched ribbon cable or a worn out solder job. It would probably be easiest to replace the top case.