Rollover is the ability of a computer keyboard to correctly handle several simultaneous keystrokes.
During normal typing on a conventional computer keyboard, only one key is usually pressed at any given time, then released before the next key is pressed. However, this is not always the case. When using modifier keys such as Shift or Control, the user intentionally holds the modifier key(s) while pressing and releasing another key. Rapid typists may also sometimes inadvertently press a key before releasing the previous one. Certain unusual forms of keyboarding require multiple keys to be pressed or held down simultaneously; for example, Braille2000 keying requires as many as six keys to be pressed at once analogous to the six dot keys of a Braille typewriter.
Some computer games require multiple keys (other than the usual modifier keys) to be held down while others are pressed and released, in order to perform actions simultaneously; a common scenario would be the holding down of two Arrow keys in order to move the player in a diagonal direction. Other scenarios might be pressing a key to interact with an object or item in the game while holding down an Arrow key to signify movement. 
Certain high-end keyboards have "n-key rollover". This means that each key is scanned completely independently by the keyboard hardware, so that each keypress is correctly detected regardless of how many other keys are being pressed or held down at the time.
However, to reduce cost and design complexity, most computer keyboards do not isolate all keys in this way. Instead, they use a matrix of key switches, without any isolation diodes, that assumes that only a limited number of keys will be held down at any given time. With these keyboards, pressing as few as three keys can cause ghosting effects, although care is taken when laying out the matrix arrangement that this does not happen for common modifier key combinations.
For the user to get the benefit of the full n-key rollover, the complete key press status must be transmitted to the computer. When the data is sent via the USB protocol, there are two operating modes: Human Interface Device (HID) "report protocol" and "boot protocol". The (optional) boot protocol, which is solely used by very limited USB host implementations such as BIOS, is limited to 8 modifier keys (left and right versions of Ctrl, Shift, Alt, and Win), followed by maximum 6 key codes. This will limit the number of simultaneous key presses that can be reported. The (mandatory) HID report protocol, which is what operating systems use, imposes no restrictions and supports full n-key rollover. The HID specification however imposes no requirements on rollover and low-end keyboards may impose the same restrictions regardless of whether the boot protocol or the HID report protocol is used.
A keyboard with "two-key rollover" can reliably detect only any two keys used simultaneously; in other words, a user can hold down any key on the keyboard and press a second key, and be sure that the keypress is correctly detected by the computer. However, if the user has two keys depressed and attempts to strike a third key, the third keypress may create a "phantom key" by shorting out the switch matrix. This is not acceptable for quality keyboards because there are many cases when more than two keys need to be depressed at the same time, such as Ctrl-Alt-Delete, or when more than two keys are depressed because of fast typing ("rolling over" more than two keys).
"Multi-key rollover" is considered essential for quality keyboards and for English-language touch typing. This is where the most common key sequences have been studied, and keys in the same common sequence are placed in the electrical switch matrix such that three keys down cannot produce a fourth "phantom" key by shorting out the matrix. The simplest way to accomplish this is to put all keys in the same common sequence on the same X or Y line of the switch matrix. As long as the electronics do not see more than two keys on different X and Y lines, which would create a phantom key, it will continue to process the next key depressed. This typically produces four- to five-key rollover for the most common key sequences.
Key jamming and ghosting
Key ghosting occurs on matrix keyboards for certain combinations of three keys. When these three keys are pressed simultaneously, a fourth keypress is erroneously registered by the keyboard controller. The Apple II keyboard notoriously produced "thje" under the fingers of a fast typist typing "the" due to ghosting.
Modern keyboards detect ghosting, and instead of registering a fourth key, they will ignore the third key, which is known as jamming. Which keys jam when pressed together differs between brands and models of keyboards.
Due to the keyboard matrix most consumer keyboards use, jamming and ghosting often occur when three out of four keys in a square block on the matrix are pressed, such as QASW or JKUI.
Most music keyboards and some high-end computer keyboards fully use isolation diodes rather than a matrix and can correctly read any combination (chording) of keys pressed in any order and released in any order—they are immune to both key ghosting and key jamming. Some "gaming keyboards" use a lattice, but give individual diodes to the most frequently-used keys in gaming such as WASD and the arrow keys.
Key jamming is often noticed when using a keyboard to play computer games where many keypresses combine to movement vectors and other, simultaneous activities rather than typing text. The original Star Control game included a utility to test for key jamming and help the player to determine the best key mapping for their keyboard, since during gameplay it was common for each of the two players to be pressing three or four keys at the same time.
Many computer games and console emulators use the control, alt, and shift keys by default. Computer keyboards typically are designed to detect these keys being activated in addition to others from the character matrix, and this may prevent key jamming.
- "Braille2000: Keyboard Requirements". Retrieved 2006-07-19.
- "Looking for a new keyboard?". 2004-10-26. Retrieved 2006-07-19.
- "TechEncyclopedia: n-key rollover". Retrieved 2011-12-03. mirror: "TechEncyclopedia: n-key rollover". Archived from the original on September 27, 2007. Retrieved 2007-09-27.
- Dribin, Dave. "Keyboard Matrix Help, section 8: "Getting Rid Of Ghosting and Masking"". Retrieved 2008-10-11.