The Flickering Backlight
MacBook Pro and MacBook Air models come equipped with an ambient light sensor, usually located near the webcam at the top of the screen. macOS uses data from this sensor to try and intelligently adjust both your screen brightness and the backlight of your physical keyboard. If you are working in a dimly lit room, the keyboard backlight automatically illuminates. However, if you are sitting near a window with shifting shadows, or if you frequently move your hands over the sensor while typing, the keyboard backlight will constantly flicker on and off, or shift in intensity, which is highly distracting.
Taking Manual Control
To stop the constant flickering and stop macOS from automatically adjusting your keyboard brightness based on the ambient light sensor, you must disable this automated feature in your system settings.
Click the Apple logo in the top-left corner of your screen and select System Settings (or System Preferences on older versions). In the left-hand navigation sidebar, scroll down and click on Keyboard. On the right-hand panel, look for the section dedicated to Keyboard illumination or backlight settings. You will see a toggle switch labelled Adjust keyboard brightness in low light. Click this toggle switch so it turns Off. Once disabled, macOS will completely ignore the ambient light sensor regarding the keyboard. You can now manually set the exact brightness level you prefer using the dedicated function keys (usually F5 and F6) on your Mac’s keyboard, and it will stay at that exact level permanently.