GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Provide a key handler based on KeyboardEvent.key instead of the deprecated keyCode · Issue #1317 · maxGraph/maxGraph

Provide a key handler based on KeyboardEvent.key instead of the deprecated keyCode #1317

New issue
Copy link
New issue
Copy link
Open
Task
Open
Provide a key handler based on KeyboardEvent.key instead of the deprecated keyCode#1317
Task
Copy link

Description

@redfish4ktc
redfish4ktc
opened on Nov 9, 2026
Issue body actions

Is your technical request related to a problem? Please describe.

maxGraph identifies keyboard keys with KeyboardEvent.keyCode, which is deprecated. Its values depend on the browser, the platform and the keyboard layout: the Command key on macOS is reported as 224 by Firefox and 91/93 by the other browsers, and 93 is the ContextMenu key on Windows. Browsers keep supporting it for compatibility, but new code is expected to use KeyboardEvent.key (the logical key) or KeyboardEvent.code (the physical key).

The numeric codes are part of the public API, not only of the internals:

  • KeyHandler stores its bindings in normalKeys, shiftKeys, controlKeys and controlShiftKeys, indexed by keyCode, and bindKey, bindShiftKey, bindControlKey and bindControlShiftKey take a code: number.
  • EditorKeyHandler.bindAction takes the same number, and EditorKeyHandlerCodec reads it from the as attribute of the XML configuration (<add as="88" control="true" action="cut"/>).
  • CellEditorHandler compares evt.keyCode to detect Escape, Enter, F2, Backspace and Delete.

The named constants of KeyCodes (added in 0.26.0) make the current code readable, but they still carry keyCode values.

Describe the solution you'd like

Provide a new key handler that identifies keys with KeyboardEvent.key (or code where the physical position matters, such as the arrow keys), next to the existing KeyHandler, and deprecate KeyHandler. Do the same for the editor part: a new counterpart of EditorKeyHandler, with its own codec and XML configuration format based on key names, and deprecate EditorKeyHandler and EditorKeyHandlerCodec.

Users keep their current code working and migrate at their own pace, and the deprecated classes are removed in a later major version. KeyCodes would be deprecated along with them, or complemented by an equivalent holding key values for the new handlers.

The internal checks that do not belong to the binding API, such as those of CellEditorHandler, can move to key directly.

Describe alternatives you've considered

  • Keep keyCode: it still works in all supported browsers, at the price of the browser-specific values above and of relying on a deprecated property.
  • Change KeyHandler and EditorKeyHandler in place, accepting both a keyCode number and a key string during a transition period: the binding maps, the signatures and the XML format would all change, which is too large a breaking change for existing users.
  • Switch the internals only, and translate the numeric bindings internally: no breaking change, but the public API keeps exposing the deprecated notion.

Additional context

Some JSDoc examples of CellEditorHandler compare keyCode ranges (digits 48 to 57, numpad digits 96 to 105) and use evt.which, which is deprecated as well. They would need updating along with the code.

Activity

  1. redfish4ktc
    added the
    Task
    issue type on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Task

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.