Most headlamps can turn on when bumped, flattening the battery. Critical to outdoor hiking safety, some manufacturers have tried to solve it. You may laugh, but nothing I have tried seems to work as well as this hot glue hack!
In the last decade or two headlamps have gone from mechanical switches to electronic push-button switches. Electronic switches allow scrolling through many features; dim, flash, flare etc. Unlike the older mechanical switches, these switches seem less prone to failure and flicker from corrosion building up on the contacts.
The weakness of a push button switch is it’s bad habit of turning on if it gets bumped and illuminating the inside of your backpack pocket as you trek all day! Dead batteries when you want to start your hiking early the next day is depressing.
My original dark blue LED Petzl headlamp circa 2000 with the old mechanical slide switch is going well 20 years later with the occasional squirt/immersion of ‘CRC contact cleaner’ to keep the switch points clean. No electrical resistance now so it’s as bright as the day I purchased it… which admittedly, is not very bright.
Baden Powell’s scouting advise is probably take batteries out for travel and take spares. Obviously, this works for people who are perfectly organised. I prefer not to do trips with these people as we annoy each other tremendously. It may be a fun Chinese puzzle assembling your smooth molded headlamp in the pitch black at a campsite, add cold wet hands, snow, but do it halfway up an ice-face at 5 am when your morning lamp use has finished, and the jolly fun of the puzzle wears thin. And spare batteries are no longer spare if you use them up by day two.
Black diamond has an electronic lock switch on the spot, but as the action to unlock is a long press on to a button, it didn’t really help me much.
Petzl make little cases for headlamps that work well.
5 min work with a hot glue gun; build it up layer upon layer, slowly.
But no one gets a button more recessed than a kiwi with a hot glue gun! Grab one of those guns you buy for a few dollars at the arts and craft shop that kids use. Plug it in and gently squeeze out glue till you have spiralled a protective ring around the button. I’ve been doing this for years, and it’s been utterly successful, objects just never push my button anymore. Occasionally the whole ring flys off if the lamp gets knocked. But just tape it back on, and just re do it later. Looks odd but it works.
My trusty black Diamond after about 2 years of hard use with the hot-glue ring. Note the glue goes opaque after time.
Good luck, Malcolm.