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

Unable to Dispatch KeyEvents #43544

Open
psygo opened this issue Sep 6, 2020 · 1 comment
Open

Unable to Dispatch KeyEvents #43544

psygo opened this issue Sep 6, 2020 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-question A question about expected behavior or functionality web-libraries Issues impacting dart:html, etc., libraries

Comments

@psygo
Copy link

psygo commented Sep 6, 2020

I've originally posted about this topic in this SO question

Dispatching KeyboardEvents seems fine, but, ideally, I would rather use the richer KeyEvent, in order to make testing much easier.

Whenever I try to dispatch an event with, for example:

document.body.dispatchEvent(KeyEvent('keypress', keyCode: 65, charCode: 97));

I get

Error: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.

I don't get why this happens, because a KeyEvent implements a KeyboardEvent, which is an Event.


Also, I don't get why the docs tell us to add to a Stream, when that is in fact not possible, or is it? — the add method is only supported if we are working with, for example, a Sink or a StreamController.

@psygo
Copy link
Author

psygo commented Sep 7, 2020

I've ended up posting about this on reddit as well.

@natebosch natebosch transferred this issue from dart-lang/html Sep 24, 2020
@lrhn lrhn added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Sep 25, 2020
@joshualitt joshualitt added web-libraries Issues impacting dart:html, etc., libraries type-question A question about expected behavior or functionality labels Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-question A question about expected behavior or functionality web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

3 participants