I'm curious, with a macbook do the right thing if you plug in a USB keyboard?
I'm not suggesting you just use a USB keyboard instead (although, now that I say it, that does seem like a solution).
What I'm actually wondering is how much work it would be just to create a single button that's an escape key on a USB stick that implements the USB keyboard protocol (but only ever reports that the escape key was hit).
It would depend if "Escape" requires a specific non-standardized scan code or not. (Even if it did you could also try sending the Ctrl-[ variety instead.)
Random piece of keyboard trivia: On Mac OS X (and I assume current variants) each keyboard is a separate "entity" with e.g. separate state which includes caps lock state. This means that the USB "Capslocker" gag USB dongles that randomly toggled Caps Lock state didn't actually affect Macs.)
If anyone is really looking for a single-key macropad... the Seeeduino Xiao is a small microcontroller development board which would suit the purpose. e.g. https://www.40percent.club/2020/08/wonky.html
Yes, it does. I do know that single-purpose keyboard extensions like this might be harder to integrate than you'd think. When I had my first Powerbook back in 2004, I bought a USB numeric keypad for entering grades into a spreadsheet quickly. One of the OS X upgrades in the following years rendered the keypad unrecognizable.
I'm not suggesting you just use a USB keyboard instead (although, now that I say it, that does seem like a solution).
What I'm actually wondering is how much work it would be just to create a single button that's an escape key on a USB stick that implements the USB keyboard protocol (but only ever reports that the escape key was hit).