I've bought a decent amount of magnetic signs and material over the years. The magnetic field isn't anywhere near strong enough to prevent a ratchet or socket from rolling around. Even the 1/4" thick flexible strips won't do it.
Foam works well if you've got a lot of time on your hands to cut out the shapes or want to buy pre-cut foam. For the sockets, holders (magnetic or otherwise) work well. For my go-to sockets I like the Lisle magnetic trays. Here's a pic of the 6-points from my metric chest. 1/2", 3/8" and 1/4" drive deep and shallow. Ignore the drawer labelling and extra space, this picture was taken while I was rearranging drawers.
Same drawer, from the side:
Another drawer in the same chest has sets in Hansen trays, which I also like but the Hansen trays are easy to spill if you take them out of the drawer. I use those sockets when it's convenient to have the chest near the work.