I think it's most likely working as a lubricant. WD40 leaves a lubricating residue that in my experience works well on creaky door hinges. I never thought to use it on sticky buttons though!
that and a non conducting pencil is handy for raising the guard on uk and irish power outlets to plug in 2 pin cables.
just that i find it easier to carry a pencil in my toolkit than risk a possibly leaking container of wd40 near the rest of my electronics.