Hi Harrison Shen,
Thanks for reaching out to Microsoft Community and posting your inquiry.
To verify if the issue is related to hardware or software, we suggest to boot to the UEFI settings. UEFI environment is outside the Windows system so any issues that persists on the UEFI could be potential hardware issues. Go to settings > Update & Security > Under Advanced Start up , click on Restart Now, once you're on the UEFI settings, Go to Troubleshoot > Advanced options > Click on Command Prompt > Type "notepad" > on the notepad, test the keys that are not working and see if it works or not while on the UEFI.
Keep us updated by replying on this thread.