-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
The onKeyDown stream occasionally returns non-KeyboardEvents #37899
Comments
Can you post the Dart code that listens to the datalist selection? You mention that the error occurs even if the code just contains the main function; can we see that main function, or the relevant listeners? |
Its content is literally the main function without any function inside it, I have no listeners on the datalist element
To test it I've created a new project with the stagehand's Bare-bones web-app template and pasted the content in there: index.html
|
The root cause here is that this API: https://api.dartlang.org/dev/2.5.0-dev.2.1/dart-html/Element/onKeyDown.html is - under some circumstances - returning an For this specific example, the |
There is a bug (?) in chrome where selecting an element in a dropdown suggestion list fires an event into onKeyDown ( #36488 seems to be that same issue ), this behavior does not exist in EdgeHTML or Firefox Using this dummy example: <!DOCTYPE html>
<html>
<body>
<input id="a" list="suggestions">
<datalist id="suggestions">
<option value="Black">
</datalist>
<script>
document.getElementById("a").onkeydown = console.log
</script>
</body>
</html> When typing "b" into a box, then selecting "Black": |
@vsmenon @sigmundch - should we try to work around this behavior in |
I generally lean towards not trying to hide what the underlying browser is doing, but I'm not opposed to doing something temporary if others feel strongly about it. Seems like we should follow up with a bug report for chrome as well? |
It looks like this behavior has been around for a while, December 2018 we got our first report. I don't know how long before that Chrome started doing this. This only happens when using |
When an option of a datalist is selected, the console throws this error ( full console ouput )
These are the elements:
The error is thrown only when the main.dart.js is imported, even if it contains only the main function without anything else.
Dart VM version: 2.4.1 (Wed Aug 7 13:15:56 2019 +0200) on "windows_x64"
I'm running the dartdevc compiler (
webdev serve
) on Chrome. When usingwebdev build
the error is not thrown.pubspec.yaml :
The text was updated successfully, but these errors were encountered: