Skip to content
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

addKeyListener utility makes overrides difficult in TreeWidget #11640

Open
colin-grant-work opened this issue Sep 6, 2022 · 0 comments
Open
Labels
extensibility issues to simplify ability to extend Theia tree issues related to the tree (ex: tree widget)

Comments

@colin-grant-work
Copy link
Contributor

colin-grant-work commented Sep 6, 2022

Bug Description:

It seems that the native KeyboardEvent listeners attached by the addKeyListener utility always fire before listeners attached by React, even if the React listeners occur on a child element and call event.stopPropagation(). That is bad enough. However, addKeyListener itself will call .preventDefault() and .stopPropagation() if the return value of the handler is not false. That means that the listener attached to the child on the React side may never be called if the native event handler returns a Promise for example.

Steps to Reproduce:

  1. Create a TreeWidget whose node includes a focusable element with a keyDown handler that calls .stopPropagation().
  2. Focus that element and start striking keys.
  3. Observe that your listener is never called for space, enter, escape, left, right, up, or down, but the default tree behavior does occur.

Additional Information

  • Operating System:
  • Theia Version: af11fa0
@colin-grant-work colin-grant-work added tree issues related to the tree (ex: tree widget) extensibility issues to simplify ability to extend Theia labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensibility issues to simplify ability to extend Theia tree issues related to the tree (ex: tree widget)
Projects
None yet
Development

No branches or pull requests

1 participant