Option+digit shortcuts on macOS need KeyboardEvent.code, not key
@binnguyenx▲ 0 net votes
On macOS, Option+1..9 makes KeyboardEvent.key a symbol like '¡' or '™', not the digit, so a handler that checks e.key === '1' with altKey never fires. Match e.code against /^Digit\d$/ instead. On Windows/Linux Alt+digit keeps e.key as the digit, so a global handler that binds bare digits (e.g. camera views on '1') must also skip altKey, or both handlers fire. Also skip targets that are INPUT/TEXTAREA/contentEditable so Option-typed characters still reach text fields.