Key code query
⌨️ Key detection
Stop the cursor on the page and press the keys one by one; the keys will be highlighted when pressed, and the detected mark will be retained after releasing.
💡 Instructions for use
- It is most effective to test the keys one by one: start with the keys in the corners and press them in sequence. The keys that light up indicate that they have been recognized by the system, and the keys that do not light up need to be investigated carefully.
- The control, shift and option keys on the left and right sides are independent buttons. Failure of the right side does not mean that there is a problem with the left side. Please specify which side it is when reporting for repair.
- Press and hold the direction keys and action keys at the same time to test the multi-key rollover capability: if any key does not light up, it means that there is a conflict in the keyboard under this combination, which is more common in ordinary membrane keyboards.
- Combinations such as refreshing, switching tabs, and task switching are prioritized by the browser or system, and the web page does not receive events. This type of unresponsiveness does not mean that the keys are damaged.
- "Key encoding" does not change with the keyboard layout and input method, and is a reliable basis for judging whether a key is recognized; "key value" will change with the layout and case.
- The inspection record can be copied or downloaded and kept as a file, and provided to the maintenance party together with the fault key location to facilitate quick reproduction of the problem.
When pressed, the encoding, key value and key code are displayed, which is the most direct comparison when making shortcut keys.
The difference between the three values
The key encoding value is based on the physical location and does not change with the layout and input method.
The key value represents the actual entered character, which is affected by layout and case.
Which one to use
For shortcut keys and game control, key coding is preferred.
The key code is a historical legacy number and is not recommended for new projects to rely on.
left and right modifier keys
The modifier keys on the left and right sides have independent codes.
Only processing one side will cause one side to be invalid.
Keyboard differences
The numbers in the numeric area and the numbers in the main key area are encoded differently.
Verification related to numbers needs to be handled separately.
Development tips
The key combination needs to determine the status of the modifier key, and only comparing the primary key will trigger it by mistake.
When recording the key codes, also write down the keyboard layout so that others can reproduce it.
Key coding is used first when making shortcut keys, which is not affected by layout and input method.
📖 Glossary
- key encoding
- The fixed number given by the browser to each physical key has nothing to do with the keyboard layout and input method, so it is best used to determine whether the key is recognized.
- Key value
- The characters actually entered by the keys will change depending on the input method and case. The same press may have different names and codes.
- Key code
- The numerical numbers used to identify buttons in the early days may have slightly different values in different browsers and layouts. Nowadays, they are mostly used to be compatible with old codes.
- Buttons not responding
- If the corresponding key on the page does not light up when pressed, it may be due to physical damage, dust, driver issues, or a browser shortcut that is occupying the combination.
- Keyboard stuck
- If it is still judged as pressed after being released, it appears as continuous input of the same character, which is often caused by liquid intrusion or spring aging.
- Key conflict
- When multiple keys are pressed at the same time, some of them are not recognized. This is related to the keyboard circuit partition and scanning method, which is especially sensitive in game scenarios.
- Multi-key no collision
- The ability to press multiple keys at the same time and still have them all recognized. Mechanical keyboards often use the number of keys that can be recognized simultaneously as an indicator.
- modifier keys
- A type of keys that do not input characters themselves and are used to combine functions, such as control, shift and option keys on the left and right sides. The left and right sides are independent keys.
- Browser retains shortcut keys
- Combinations that are prioritized by the browser or system, such as refreshing, closing tabs, and task switching, usually cannot be intercepted by the web page, and you will see "no response" during detection.
- Scan code
- The original number reported by the keyboard hardware is different from the key encoding; some tools require a driver or local program to read it.
🔗 All keywords and tutorials
❓ FAQ
- Are left and right Shift codes the same?
- Not the same. The left and right sides each have independent codes and need to be bound separately or processed uniformly.
- Why are the keycodes inconsistent with the new properties?
- The two origins are different: the former is a historical number, and the latter is defined by physical location, and their meanings are not equivalent.