In the cases described, the rider's fingers touched the flash or high beam button when working the clutch. But if the light switches without being touched, the switch block itself and the wiring need checking.
Check it parked, wearing gloves
Repeat a normal clutch pull and watch which finger touches the button. Assess the angle of the lever and the switch block, and access to the other controls. A small adjustment of their positions can stop the accidental presses.
The switch block must not be rotated arbitrarily past its locating pin or so far that the harness is stretched. After any change, check full steering lock and that the clutch works normally.
If there is no contact
See whether the button returns and whether the symptom depends on rain, washing or turning the bars. A light that switches on electrically by itself will not be cured just by a different finger position.
The sources include workshop visits for sticking buttons and a replaced switch block. For diagnosis, a video showing both the hand and the light indicator is useful. Faults after water are covered separately, stretched wiring in its own article.