[missing] KeyboardEvent needs some TLC #17560
Labels
area-library
closed-obsolete
Closed as the reported issue is no longer relevant
library-html
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
KeyboardEvent contains these declarations (ignoring DOM_KEY_LOCATION_* and private declarations):
altGraphKey
altKey
charCode
ctrlKey
getModifierState
keyCode
keyLocation
location
metaKey
repeat
shiftKey
According to this program:
@MirrorsUsed(targets: 'KeyboardEvent')
import 'dart:mirrors';
import 'dart:html';
void main() {
var list = reflectClass(KeyboardEvent).declarations.keys.map(MirrorSystem.getName).toList()..sort();
print(list.join("\n"));
}
According to MDN (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent), the following attributes are deprecated or have been dropped:
char
charCode
keyCode
So let's remove those from the API and see what we're left with, grouped by purpose:
Modifiers:
altGraphKey, altKey, ctrlKey, metaKey, shiftKey, getModifierState
Location:
keyLocation, location
Automatically repeated key (key held down):
repeat
This leaves us with an interface that allows us to determine:
* if a key was pressed.
* if a modifier was engaged when said key was pressed.
* if the key was on the left-hand side, right-hand side, or the numeric keypad.
* if it was the result of a key being held down.
The following is NOT possible to determine:
* What key was pressed.
* Does the key represent a printable character.
I'd say that something is really wrong if you cannot determine which key was pressed.
The text was updated successfully, but these errors were encountered: