Dead Keys on International Keyboard Layouts
A dead key is a special key on international keyboard layouts that does not produce a character immediately when pressed. Instead, it modifies the next keystroke, combining with it to produce an accented or otherwise modified character. Dead keys are the foundation of how standard keyboards accommodate dozens of accented characters without requiring separate physical keys for each.
How Dead Keys Work
When you press a dead key, nothing appears on screen. The system enters a "waiting" state. If you then press a compatible base character, the combined character is output. If you press an incompatible key or press the dead key again, the dead key character itself may be output, followed by the second character.
Common Dead Key Examples
On a US International keyboard layout:
| Dead Key | + Base | Result |
|---|---|---|
' (dead acute) |
e |
é (U+00E9) |
' (dead acute) |
a |
á (U+00E1) |
` (dead grave) |
e |
è (U+00E8) |
^ (dead circumflex) |
o |
ô (U+00F4) |
~ (dead tilde) |
n |
ñ (U+00F1) |
" (dead diaeresis) |
u |
ü (U+00FC) |
Layout Implementations
Different keyboard layouts use dead keys for different characters:
AZERTY (French): The ² key and certain positions produce dead diacritics used in French.
QWERTZ (German/Swiss): The ^ key is typically a dead circumflex. Swiss layouts have extensive dead key support for umlauts and other characters.
Nordic layouts: Dead keys for ring above (å base), umlaut, and other Nordic-specific diacritics.
US International: A popular choice for programmers who write in English but occasionally need accented characters. Converts ', ", `, ^, and ~ into dead keys.
Producing the Dead Key Character Itself
To type an apostrophe or quotation mark on a US International layout (where these are dead keys), press the dead key followed by a space. This outputs the character without combining:
- Dead acute + Space →
' - Dead diaeresis + Space →
"
Programming Implications
Dead keys operate at the operating system level and are transparent to applications—the application receives the final composed character, not the individual keystrokes. This means web applications handling keydown and keyup events will see the composed character in input events, but may see unusual key values during the dead key state.
// keydown event during dead key press
// event.key may be "Dead" or the combining character name
document.addEventListener('keydown', (e) => {
if (e.key === 'Dead') {
// Dead key was pressed; wait for composition
}
});
// Use 'input' event for reliable character input
input.addEventListener('input', (e) => {
console.log(e.data); // The composed character
});
Composition Events
For complex input scenarios (including dead keys), browsers fire composition events:
compositionstart: Dead key pressed, composition beginscompositionupdate: Intermediate statecompositionend: Final character produced
This event sequence is shared with IME input, making composition events the correct way to handle complex character input across all platforms.
Testing Keyboard Accessibility
Applications that intercept keystrokes (games, shortcuts, custom inputs) must handle dead key states gracefully. Preventing default on keydown for dead keys can break character composition entirely, making the application unusable for speakers of many European languages.