Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

KeyboardEvent.key support for control and special characters

Ouverte
#722 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
52/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
java
Domaine
backend

Piste de recherche

Read src/main/java/org/htmlunit/javascript/host/event/KeyboardEvent.java, especially determineKey(), and compare its current mappings with the MDN table of control and special key values linked in the issue. Add support for the missing keys, then verify that sendKeys(Keys.UP) yields ArrowUp for KeyboardEvent.key and run relevant keyboard event tests.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

We are happily using HtmlUnit 3.4 with Selenium and wanted to get rid of some legacy usage of the deprecated KeyboardEvent.keyCode in our web application.
The most portable replacement would be KeyboardEvent.key, but this is currently not working for arrow keys. For example sendKeys(Keys.UP) on a element yields & in JavaScript for KeyboardEvent.key as opposed to the expected "ArrowUp". & in ASCII is 0x26 which is the corresponding KeyboardEvent.keyCode.

Stating from the implementation the current support for KeyboardEvent.key seems to be limited to printable characters, "Shift", "Enter" and Period (KeyboardEvent.determineKey()).

As KeyboardEvent.key is part of the W3C UI Events standard and is broadly supported by current browsers (caniuse) it would be really nice to have this as well in HtmlUnit.
Mozilla provides a extensive table of common control and special characters in the mdn

Thanks for the continuous support and effort you put into HtmlUnit.

Langage dominant
JavaScript
Étoiles
952
Forks
183
Merge moyen
2 j 1 h
PR mergées (30 j)
1

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de HtmlUnit/htmlunit

Toutes les issues de HtmlUnit/htmlunit

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.