Dart sample Enter key not working in FF or Safari #320

Closed
sethladd opened this Issue Nov 12, 2012 · 7 comments

Projects

None yet

3 participants

@sethladd

No description provided.

@sethladd

Fork isn't working (returns a 404) but in the meantime, here's the fix:

In TodoApp.dart:

    newTodoElement.on.keyPress.add((KeyboardEvent e) {
        if (e.keyCode == 13) {
            var title = newTodoElement.value.trim();

Note, use e.keyCode. There is a bug with e.keyIdentifier: http://code.google.com/p/dart/issues/detail?id=4269

@sethladd

This also works, and is probably better:

void initElementEventListeners() {
    InputElement newTodoElement = query('#new-todo');

    newTodoElement.on.keyPress.add((KeyboardEvent e) {
        if (e.keyCode == KeyCode.ENTER) {
            var title = newTodoElement.value.trim();

Note the use of KeyCode.ENTER

@MathieuLorber

Ok, it works on my Safari and FF. I try to give a look at IE later

@MathieuLorber

I try to make a correct pull request later today...

@MathieuLorber

I'm a bit late but corrected ENTER code in main input & in todo edition. I pushed the compiled js files too.

@addyosmani
Member

I believe this is now fixed. Let me know if we've missed anything!

@addyosmani addyosmani closed this Nov 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment