From stackoverflow: https://stackoverflow.com/questions/36976117/css-media-query-for-whether-a-physical-keyboard-is-attached
Use case: I want show keyboard shortcut labels in my menu / tooltips but only when the user has a physical keyboard.
Rationale (taken directly from the above SO issue):
- nobody would use a soft-keyboard this way even if they could
- the visual display of the keyboard shortcut takes up valuable real-estate
- it's perhaps confusing, or at least inelegant, to display keyboard shortcuts in a keyboardless context
Apparently some people are doing horrible hacks like using @media (hover: hover) and (pointer: fine) { ... } to detect if there is a mouse/trackpad and assuming that means there is a keyboard too.
From stackoverflow: https://stackoverflow.com/questions/36976117/css-media-query-for-whether-a-physical-keyboard-is-attached
Use case: I want show keyboard shortcut labels in my menu / tooltips but only when the user has a physical keyboard.
Rationale (taken directly from the above SO issue):
Apparently some people are doing horrible hacks like using
@media (hover: hover) and (pointer: fine) { ... }to detect if there is a mouse/trackpad and assuming that means there is a keyboard too.