The article's DIYer also chose to place a magnet inside the keyboard and another on the inside of the mouse, specifically "on the bottom of the case front-and-center just ahead of the mouse wheel." According to the author:

I like to have a lot of desk surface when I need to spread out schematics and other multi-page documents. This time, though, I decided that the thin replacement keyboard and lightweight mouse could be modified to "stick" on the wall at the back of my desk for when I wanted to put them away.

I decided to use some strong magnets to keep them on that wall. The keyboard and mouse weight would rest, as you can see from the picture, on the "splash guard" on the back of my desk. (My desk is made from a counter top.) The magnets wouldn't need to bear the weight of the keyboard and mouse, but only needed to keep it upright against the wall.

Check out the full post for the step-by-step and, if you're inspired, take a look at our other magnetic hacks.