Your MacBook, MacBook Air, or MacBook Pro might go to sleep unexpectedly if a magnet is placed under your computer or on its palm rest. Here are a few ways this might happen:

Placing an iPhone, iPad, or magnetic device on your computer's palm rest. iPhone speakers and most iPad cases contain magnets.

Placing an Apple Watch or its magnetic charging cable on your computer's palm rest, or resting your wrist on the palm rest while wearing Apple Watch. Some watch bands contain magnets.

Stacking computers. The magnet in the bottom computer might turn on the switch in the top computer. For example, if you turn on the top computer, it might go to sleep before it starts up.

Placing your computer on magnetized items.