Skip to content

webagg reports incorrect values for non-alphanumeric key events on non-qwerty keyboards #19128

@anntzer

Description

@anntzer

Bug report

Bug summary

Non alphanumeric key events are reported incorrectly on webagg.

Code for reproduction

MPLBACKEND=webagg python -c 'from pylab import *; plot(); gcf().canvas.mpl_connect("key_press_event", lambda e: print(e.key)); show()'

then press some keys while using e.g. an https://en.wikipedia.org/wiki/AZERTY keyboard layout.

Actual outcome

& is reported as 1, etc.

Expected outcome

Correct keys.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: head
  • Matplotlib backend (print(matplotlib.get_backend())): webagg
  • Python version: 39

From a quick look mpl.js is using https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which + a hard-coded table; MDN says that which is deprecated and suggests using https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUI: webaggGood first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions