These flash alerts might be useful if your Mac is trying to let you know something is not quite right with the action you’re performing on your Mac.
It could be that you’re not clicking on the right spot or entering characters that aren’t allowed or any other actions that require your attention.
To set it up, go to System Preferences > Accessibility > Audio > check the box “Flash the screen when an alert sound occurs”.
You can even click the button “Test Screen Flash” to see how it looks like.