The laptop is working as it was intended. Modern laptops use a HALL effect sensor. It is to detect when you are closing the Liquid Crystal Display (LCD) lid for the sensor to turn off the display. The sensor is placed into the palm rest and lid of the laptop. When the LCD is in the closed position, it engages the sensor. The main purpose of the Hall sensor is to turn off the integrated LCD, and if present to move the video to an external monitor. The display would not turn off when the laptop lid was closed, if the sensor was not there. This would heat the laptop unnecessarily, use more power, you must physically switch to an external screen, and enter into hibernate or sleep mode.
Older laptops typically have a HALL sensor that is located along the rear of the laptop. (Between the bottom of the LCD and the top of the Palm rest.) Most modern laptops have it located along the top edge of the LCD and bottom of the palm rest. However, it is safer to think of the placement of the sensor as located somewhere around the edge of the LCD screen and the palm rest.
The HALL sensor can contribute to no video issues, random shutdowns, or situations where a laptop goes into sleep or hibernate mode unexpectedly. This can occur when your laptop is exposed to magnetic fields from an outside source. (For example: When an outside magnetic source is placed near the HALL sensor.)
These items can include, but are not limited to:
A magnetic field impacting a HALL sensor shows the following symptoms:
Here are some recommended articles related to this topic that might be of interest to you.