If you’re going to drink coffee (or something else) near your laptop, having a mug with a lid (like a travel mug) is a great idea.
Make sure you leave the lid closed when you’re not drinking out of the travel mug.
If for some reason you get coffee on your keyboard:
- Unplug your laptop and disconnect everything attached to it.
- Turn the laptop off.
- Remove the battery if you can.
- Leave the laptop open at an acute angle (under 90°) and turn it upside down onto a towel (or paper towels).
- Don’t touch it for 48-72 hours (the longer the better).
- Reattach the battery (if necessary) and turn it on. If it turns on and works fine, great! If not, take it to be repaired.
Buying a silicone keyboard protector is probably a good idea.
I learned this the hard way…