My home door lock has a pretty cool way to counteract this.
Here's a picture of what it looks like
https://www.digitaltrends.com/wp-content/uploads/2021/07/loc...
Every time you press a button, all the numbers shuffle around. Even if someone watches you enter the passcode, they can't be certain of what the password actually was.
They do gain some information (the first digit must be either a two, a six, or a nine), but they don't get the full information.