Visualiseur de Keycode / Événement
Appuyez sur n'importe quelle touche pour voir son code JavaScript, nom de touche et propriétés d'événement
Appuyez sur une touche...
Prochaines etapes suggerees
Outils Associés
Comparaison de texte
Comparer les differences entre deux textes
Testeur Regex
Tester et deboguer des expressions regulieres
Analyseur d'Expressions Cron
Analyser et visualiser les expressions de planification Cron
Analyseur d'URL
Décomposez les URL en leurs composants individuels
Codes de Statut HTTP
Référence rapide pour tous les codes de statut HTTP et leurs significations
Testeur d'API
Envoyez des requêtes HTTP et visualisez les réponses
Comment utiliser
Ouvrez l'outil
Aucune configuration nécessaire — l'outil se charge instantanément dans votre navigateur.
Interagissez et explorez
Utilisez votre souris, clavier ou écran tactile pour interagir en temps réel.
Utilisez partout, à tout moment
Fonctionne sur ordinateur et mobile — pratiquez ou créez en déplacement.
Pourquoi utiliser cet outil
100 % Gratuit
Aucun coût caché, aucun niveau premium — chaque fonctionnalité est gratuite.
Aucune installation
Fonctionne entièrement dans votre navigateur. Aucun logiciel à télécharger ou installer.
Privé et sécurisé
Vos données ne quittent jamais votre appareil. Rien n'est envoyé sur un serveur.
Fonctionne sur mobile
Entièrement adaptatif — utilisez-le sur votre téléphone, tablette ou ordinateur.
JavaScript Keyboard Events: KeyCodes, Keys, and Codes
Key Takeaways
- The deprecated keyCode property has been replaced by the modern key (character value) and code (physical key) properties.
- Understanding the difference between key and code is essential for building keyboard shortcuts and games that work across keyboard layouts.
- All keyboard event detection happens in your browser — no keystrokes are recorded or transmitted.
Keyboard event handling is fundamental to interactive web applications — from keyboard shortcuts and form validation to games and accessibility features. JavaScript keyboard events have evolved significantly, with the deprecated keyCode property being replaced by the more intuitive key and code properties. Understanding these properties and their differences is essential for building robust keyboard interactions.
The key and code properties are supported in 97%+ of global browsers, making keyCode truly obsolete.
Browser Support
Key Concepts
key vs. code Properties
event.key represents the character value ('a', 'A', 'Enter', 'ArrowUp'). event.code represents the physical key ('KeyA', 'ShiftLeft', 'Digit1'). Use key for text input and code for keyboard shortcuts.
Event Types: keydown, keyup, keypress
keydown fires when a key is pressed (repeats while held). keyup fires when released. keypress is deprecated. Use keydown for most interactions and keyup for detecting when modifier keys are released.
Modifier Keys
event.ctrlKey, event.shiftKey, event.altKey, and event.metaKey (Cmd on Mac) are boolean properties that indicate which modifier keys were held during the event. Use them for keyboard shortcut combinations.
Layout-Independent Keycodes
event.code always refers to the physical key position regardless of keyboard layout. 'KeyA' is always the leftmost home-row key, even on AZERTY keyboards where it types 'q'. Use code for games, key for text.
Pro Tips
Use event.key for accessibility — screen readers and assistive technologies rely on semantic key values, not physical positions.
Always handle both Ctrl (Windows/Linux) and Meta/Cmd (Mac) for cross-platform keyboard shortcuts.
Call event.preventDefault() to stop default browser behavior for keyboard shortcuts (like Ctrl+S) but be careful not to break expected behaviors.
Use the 'isComposing' property to avoid interfering with IME (Input Method Editor) composition for CJK language input.
All keyboard event detection is performed entirely in your browser. No keystrokes are recorded, logged, or transmitted to any server.