Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer opened this issue Dec 16, 2020 · 2 comments · Fixed by #19146
Closed
Labels
Good first issue Open a pull request against these issues if there are no active ones! GUI: webagg
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Dec 16, 2020

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.

@anntzer anntzer added GUI: webagg Good first issue Open a pull request against these issues if there are no active ones! labels Dec 16, 2020
@tonadev
Copy link
Contributor

tonadev commented Dec 17, 2020

You can reproduce the bug on non-US keyboard layouts. I would like to work on this. Can I work on this?

@timhoffm
Copy link
Member

👍 You are welcome to.

QuLogic added a commit that referenced this issue Feb 17, 2021
Fix #19128: webagg reports incorrect values for non-alphanumeric key events on non-qwerty keyboards
@QuLogic QuLogic added this to the v3.4.0 milestone Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Open a pull request against these issues if there are no active ones! GUI: webagg
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants